Closed JunkyByte closed 1 year ago
Running without the -m
works correctly if I add the sam-pt/
path to sys modules in demo.py
before importing sam_pt
import sys
sys.path.append('./')
Hej, what do you get when running the following commands in your terminal:
python -c "import sys; print(sys.path)"
# ['',
# '/scratch_net/biwidl217/frrajic/miniconda3/envs/sam-pt/lib/python38.zip',
# '/scratch_net/biwidl217/frrajic/miniconda3/envs/sam-pt/lib/python3.8',
# '/scratch_net/biwidl217/frrajic/miniconda3/envs/sam-pt/lib/python3.8/lib-dynload',
# '/scratch_net/biwidl217/frrajic/miniconda3/envs/sam-pt/lib/python3.8/site-packages']
python -c "import demo; print(demo.__path__)"
# _NamespacePath(['/scratch_net/biwidl217/frrajic/eth-master-thesis/03-code/sam-pt/demo'])
python -c "from demo import demo as demo; print(demo.__file__)"
# /scratch_net/biwidl217/frrajic/eth-master-thesis/03-code/sam-pt/demo/demo.py
Note that the last command would probably give an error for you.
Hi!
$ python -c "import sys; print(sys.path)"
['', '/opt/homebrew/Cellar/python@3.9/3.9.17/Frameworks/Python.framework/Versions/3.9/lib/python39.zip', '/opt/homebrew/Cellar/python@3.9/3.9.17/Frameworks/Python.framework/Versions/3.9/lib/python3.9', '/opt/homebrew/Cellar/python@3.9/3.9.17/Frameworks/Python.framework/Versions/3.9/lib/python3.9/lib-dynload', '/Users/junkybyte/Library/Python/3.9/lib/python/site-packages', '/opt/homebrew/lib/python3.9/site-packages']
[...]/sam-pt$ python -c "import demo; print(demo.__path__)"
Traceback (most recent call last):
File "<string>", line 1, in <module>
AttributeError: module 'demo' has no attribute '__path__'
The problem is fixed and the commands listed in your docs work correctly if I add a __init__.py
to demo/
.
Once I do that every command runs correctly
python -c "from demo import demo as demo; print(demo.__file__)"
/Users/junkybyte/Documents/sam-pt/demo/demo.py
junkybyte@~/Documents/sam-pt$ python -c "import demo; print(demo.__path__)"
['/Users/junkybyte/Documents/sam-pt/demo']
I've added empty __init__.py
files to all relevant directories since for some systems they are required to make Python treat directories as packages. Thanks!
Hello, thanks for your work. I installed the checkpoints and setup the environment but I am not able to run the demo.