Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Julia only working if you install kspdg package directly from this repository #19

Open
OhhTuRnz opened this issue Nov 17, 2024 · 3 comments

Comments

@OhhTuRnz
Copy link

Hi! Thank you for all your work.

I find problems with the installation of kspdg with pip install using julia if the folder and repository where I install kspdg is not exactly the one cloned from this repository. We wanted to upload this repo in a private repo from our organization to start developing there. Any idea on how to solve this? I am thinking on installing kspdg using this repository and then using the other repository with the environment created from here.

Thank you in advance.

@rallen10
Copy link
Collaborator

Hi @OhhTuRnz ,

I might need a bit more detail to help debug. Is there a specific error message you can share? What pip command are you using to try to install kspdg or your fork of kspdg?

As a possible alternate approach: when I want to develop agents to be tested in kspdg, I create a new repository for the agents that depends on this repo, but does not clone/modify this repo. For example, I could create a new repo called ohhturnz-agents with a conda environment.yml file to create a conda environment called ohhturnz_agents. Then in that conda environment, I would install the kspdg dependency with a command like

conda activate ohhturnz_agents
pip install git+ssh://[email protected]/mit-ll/spacegym-kspdg.git

Then my new repo only contains code for creating agents to be tested in kspdg scenarios and does not contain the kspdg scenario code

@OhhTuRnz
Copy link
Author

OhhTuRnz commented Nov 19, 2024

Hi @rallen10,

Thanks for your rapid response.

Yes, the problem raises in serverless tests, and is this:

ERROR tests/serverless_tests/test_jl_solvers.py - NameError: name '__lg3_envs_module' is not defined
Module kspdg.private_src.python3_12.Windows_x86_64.kspdg_envs.lbg1.lg3_envs not found.

I think it just doesn't detect the installed kspdg module or some of its dependencies (maybe because of relative path names?).

Anyway, your solution makes sense so I will try that.

When installing the conda environment with your repo, all tests pass, and I can switch to my own agents using that environment. However, I can only load the environment for my agents if I first run your hello agent. Otherwise, it throws an error where the init method for my env fails to load.

Is that because we need to reset the environment before loading?

@rallen10
Copy link
Collaborator

Per your error message: I don't believe it should be using relative paths based on the directory structure, exactly. Rather it should be using "relative python modules", which are closely related to the directory structure, but not identical. In other words, I think you should be able to make a fork of spacegym-kspdg and change the top-level directory name, and the imports should still work as long as you keep src/kspdg named the same thing.

The fact that you are getting this error specifically for lg3_envs is interesting, though, and probably hints at some other/underlying problem. lg3_envs are the obfuscated code that was generated using pyarmor and require a lot of special handling in order to work across platforms (windows, mac, linux) and python versions (3.9, 3.12, and I'm working on 3.13). I'm guessing there is something about the special handling of the obfuscated code that is causing the problem.

Per your commend on loading environments: that sounds strange to me. I would need to see your code and how you are loading the environment. You should not need to run my hello-kspdg agent first; you should be able to use that agent as a template for creating your own agent and run it on its own: https://github.com/mit-ll/spacegym-kspdg?tab=readme-ov-file#example-agent-environment-runner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants