Closed yb6599 closed 2 months ago
Also, running
import mitosis
lookup = mitosis.unpack('ksindy_pde_figs.config:lookup_dict')
print(lookup)
returns the lookup_dict and works as intended.
:thinking: I wonder... are you sure these were both run in the same environment?
The other thing is... try activating the environment but running
import mitosis
lookup = mitosis.unpack('ksindy_pde_figs.config:lookup_dict')
print(lookup)
from outside the repository. It could be picking up the import based upon sys.path[0]
I wonder... are you sure these were both run in the same environment?
Yes
try activating the environment but running from outside the repository.
Okay, this gives me:
Traceback (most recent call last):
File "/home/yash6599/debug.py", line 2, in <module>
lookup = mitosis.unpack('ksindy_pde_figs.config:lookup_dict')
File "/home/yash6599/Kalman-SINDy-PDE/.venv/lib/python3.10/site-packages/mitosis/__init__.py", line 600, in unpack
obj = import_module(modname)
File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 992, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'ksindy_pde_figs'
Update: I've solved this bug, experiments running like before again, the error originated was
pip install -e .
Obtaining file:///home/yash6599/Kalman-SINDy-PDE
Installing build dependencies ... done
Checking if build backend supports build_editable ... done
Getting requirements to build editable ... error
error: subprocess-exited-with-error
× Getting requirements to build editable did not run successfully.
│ exit code: 1
╰─> [14 lines of output]
error: Multiple top-level packages discovered in a flat-layout: ['trials', 'ksindy_pde_figs'].
To avoid accidental inclusion of unwanted files or directories,
setuptools will not proceed with this build.
If you are trying to create a single distribution with multiple packages
on purpose, you should not rely on automatic discovery.
Instead, consider the following options:
1. set up custom discovery (`find` directive with `include` or `exclude`)
2. use a `src-layout`
3. explicitly set `py_modules` or `packages` with a list of names
To find more information, look for "package discovery" on setuptools docs.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× Getting requirements to build editable did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
I've fixed this by setting up setuptools package discovery in pyproject.toml
, but is it better if I make src
and keep ksindy_pde_figs
and trials
in src
?
Yeah, well done! that was what I was thinking about with trying to run from outside the folder. I don't know why setuptools is finding the trials folder if it doesn't have an __init__.py
. I prefer option 3, setting the packages
in pyproject.toml
.
Regardless, if you had gone the src
route, you wouldn't also move trials
into src
, because it's not the package source code.
Got it, thanks!
Hey @Jacob-Stevens-Haas,
I had some environment issues and had to remove my repo (kalman-sindy-pde) and clone it again. I know I haven't made any changes that would affect the experiments. However, when I run it, mitosis does not recognize the
ksindy_pde_figs
module, which contains theconfig.py
. Thepyproject.toml
is still the same,This has been unchanged and I ran experiments this morning, so it must be something to do with the environment setup I did after recloning. The error I get is
I haven't been able to figure it out, what should I do?