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

Python version>=3.9? #118

Open
whyydsforever opened this issue Jun 22, 2023 · 7 comments
Open

Python version>=3.9? #118

whyydsforever opened this issue Jun 22, 2023 · 7 comments

Comments

@whyydsforever
Copy link

when I ran the code --python setup.py develop
It turned out that
Processing scipy-1.11.0rc2.tar.gz
Writing /tmp/easy_install-7tv5fusw/scipy-1.11.0rc2/setup.cfg
Running scipy-1.11.0rc2/setup.py -q bdist_egg --dist-dir /tmp/easy_install-7tv5fusw/scipy-1.11.0rc2/egg-dist-tmp-8nqf7m51
Traceback (most recent call last):
File "/root/miniconda3/lib/python3.8/site-packages/setuptools/sandbox.py", line 152, in save_modules
yield saved
File "/root/miniconda3/lib/python3.8/site-packages/setuptools/sandbox.py", line 193, in setup_context
yield
File "/root/miniconda3/lib/python3.8/site-packages/setuptools/sandbox.py", line 254, in run_setup
_execfile(setup_script, ns)
File "/root/miniconda3/lib/python3.8/site-packages/setuptools/sandbox.py", line 43, in _execfile
exec(code, globals, locals)
File "/tmp/easy_install-7tv5fusw/scipy-1.11.0rc2/setup.py", line 33, in
"ase",
RuntimeError: Python version >= 3.9 required.

@bdecost
Copy link
Collaborator

bdecost commented Jun 22, 2023

it looks like newer versions of scipy require python 3.9 or newer

you might be able to downgrade scipy to a version that will work with 3.8, but I would recommend upgrading your python version to 3.10 if possible. (last I checked PyTorch had some compatibility issues with python 3.11)

@bdecost
Copy link
Collaborator

bdecost commented Jun 22, 2023

I saw that our README specifies python 3.8, so that will need to be updated...

if you're using anaconda, you should change the environment setup to conda create --name alignn python=3.10

also, if you are using CUDA, it's best to manually install the GPU versions of PyTorch and dgl before installing alignn

Assuming you're on linux and you want CUDA 11.8

conda activate alignn
conda install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia
conda install -c dglteam/label/cu118 dgl

then you can do an in-place install of alignn:

git clone https://github.com/usnistgov/alignn && cd alignn
python -m pip install -e .

@bdecost
Copy link
Collaborator

bdecost commented Jun 22, 2023

One more thing that I recently encountered - in some of my code I'm hitting a possible CUDA bug in the latest version of dgl, so you may wish to install an older version (v1.0.2 does not have the aforementioned issue - you can get it with conda install -c dglteam/label/cu118 dgl==1.0.2.cu118)

@whyydsforever
Copy link
Author

If it is possible just downgrade the scipy?

@bdecost
Copy link
Collaborator

bdecost commented Jun 22, 2023

If it is possible just downgrade the scipy?

it's probably possible, unless some other dependency requires a new version of scipy

@whyydsforever
Copy link
Author

After I downgrade the scipy it seems to work, but still got some issues:
Engine run is terminating due to exception: use_deterministic_algorithms() got an unexpected keyword argument 'warn_only'
Traceback (most recent call last):
File "/root/miniconda3/bin/train_folder.py", line 7, in
exec(compile(f.read(), file, 'exec'))
File "/root/alignn/alignn/train_folder.py", line 197, in
train_for_folder(
File "/root/alignn/alignn/train_folder.py", line 180, in train_for_folder
train_dgl(
File "/root/alignn/alignn/train.py", line 961, in train_dgl
trainer.run(train_loader, max_epochs=config.epochs)
File "/root/miniconda3/lib/python3.8/site-packages/pytorch_ignite-0.5.0.dev20230622-py3.8.egg/ignite/engine/engine.py", line 906, in run
return self._internal_run()
File "/root/miniconda3/lib/python3.8/site-packages/pytorch_ignite-0.5.0.dev20230622-py3.8.egg/ignite/engine/engine.py", line 949, in _internal_run
return next(self._internal_run_generator)
File "/root/miniconda3/lib/python3.8/site-packages/pytorch_ignite-0.5.0.dev20230622-py3.8.egg/ignite/engine/engine.py", line 1007, in _internal_run_as_gen
self._handle_exception(e)
File "/root/miniconda3/lib/python3.8/site-packages/pytorch_ignite-0.5.0.dev20230622-py3.8.egg/ignite/engine/engine.py", line 645, in _handle_exception
raise e
File "/root/miniconda3/lib/python3.8/site-packages/pytorch_ignite-0.5.0.dev20230622-py3.8.egg/ignite/engine/engine.py", line 960, in _internal_run_as_gen
self._fire_event(Events.STARTED)
File "/root/miniconda3/lib/python3.8/site-packages/pytorch_ignite-0.5.0.dev20230622-py3.8.egg/ignite/engine/engine.py", line 432, in _fire_event
func(*first, *(event_args + others), **kwargs)
File "/root/miniconda3/lib/python3.8/site-packages/pytorch_ignite-0.5.0.dev20230622-py3.8.egg/ignite/engine/deterministic.py", line 196, in _init_run
torch.use_deterministic_algorithms(True, warn_only=True)
TypeError: use_deterministic_algorithms() got an unexpected keyword argument 'warn_only'

@bdecost
Copy link
Collaborator

bdecost commented Jun 22, 2023

can you share which version of PyTorch you have installed? I was able to make a clean python 3.8 environment with PyTorch 2.0.1 and DGL "1.0.2+cu118", and I had no issues running the train_folder.py example from the README

Here are the steps I used to set up the environment:

conda create --name alignn38 python=3.8
conda activate alignn38
conda install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia
conda install scipy
conda install -c dglteam/label/cu118 dgl==1.0.2.cu118
git clone https://github.com/usnistgov/alignn && cd alignn
python -m pip install -e .

I still would encourage switching to python 3.10 because the 3.9 and 3.10 releases introduced a bunch of performance increases and much better error message formatting

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