Jammy2211 / autolens_workspace

The PyAutoLens workspace: contains example scripts, datasets and more
https://pyautolens.readthedocs.io/
24 stars 16 forks source link

No module found #1

Closed LovelyBuggies closed 4 years ago

LovelyBuggies commented 4 years ago

@Jammy2211 I met a module found error when I run the howtolens notebooks. I have autolens installed and PYTHONPATH and WORKSPACE set. I don't know what this error occurs.

FileNotFoundError: [Errno 2] No such file or directory: '/path/to/autolens_workspace//config/priors.json'
Jammy2211 commented 4 years ago

Hi there :)..

First, update to autolens v 0.40.0. This isn't really the issue, but we did a release yesterday so good to be up to date!

pip install autolens==0.40.0

Next, re download the workspace as we slightly edited the configs (you can simply delete the existing workspace).

Finally, the issue is that in the Jupyter notebooks you have to manually set the path to the configs in the autolens workspace. The path:

'/path/to/autolens_workspace//config/'

Is not a real path on your pc. You need to change this to the true path of the config on your computer. For me, I would set this string as:

'/james/home/PyAutoLens/autolens_workspace//config'

This is only true in certain notebooks, but is somethiing you'll need to do manually.

LovelyBuggies commented 4 years ago

Thanks for replying. I will have a try and give you the feedback later.

LovelyBuggies commented 4 years ago

@Jammy2211 Still not working. I'm in project folder and set PYTHONPATH and WORKSPACE as ./. An error is raised in the first import code cell:

NoSectionError: No section: 'Could not find section general in config at path .//config/visualize/general.ini'

While, things got right when

python3 ./runners/beginner/no_lens_light/lens_sie__source_inversion.py
Jammy2211 commented 4 years ago

The PYTHONPATH and WORKSPACE must be set as the full path, not a relative path.

So, do not use


WORKSPACE=./
PYTHONPATH=./

Instead use


WORKSPACE=/home/user/folder/autolens_workspace/
PYTHONPATH=/home/user/folder/autolens_workspace/

Obviously, the 'home/user/folder' should correspond to the correct path on your computer.

To find the full path to your workspace, on a command line in the autolens_workspace (e.g. after using 'cd' to get there) you can type 'pwd'.

LovelyBuggies commented 4 years ago

Yep, it works!

Jammy2211 commented 4 years ago

:)