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 should be downgraded in environment.yml #55

Open
asan-emirsaleh opened this issue May 29, 2023 · 3 comments
Open

Python version should be downgraded in environment.yml #55

asan-emirsaleh opened this issue May 29, 2023 · 3 comments

Comments

@asan-emirsaleh
Copy link

asan-emirsaleh commented May 29, 2023

Hello!
Here is an issue I have recently encountered: the python version was incompatible with the networkx package.

Traceback (most recent call last):
  File "/project/_app/Lace/Lace/Lace_run.py", line 14, in <module>
    from Lace.BuildSuperTranscript import SuperTran
  File "/home/user/miniconda3/envs/lace/lib/python3.11/site-packages/Lace/BuildSuperTranscript.py", line 11, in <module>
    import networkx as nx
  File "/home/user/miniconda3/envs/lace/lib/python3.11/site-packages/networkx/__init__.py", line 114, in <module>
    import networkx.generators
  File "/home/user/miniconda3/envs/lace/lib/python3.11/site-packages/networkx/generators/__init__.py", line 14, in <module>
    from networkx.generators.intersection import *
  File "/home/user/miniconda3/envs/lace/lib/python3.11/site-packages/networkx/generators/intersection.py", line 13, in <module>
    from networkx.algorithms import bipartite
  File "/home/user/miniconda3/envs/lace/lib/python3.11/site-packages/networkx/algorithms/__init__.py", line 16, in <module>
    from networkx.algorithms.dag import *
  File "/home/user/miniconda3/envs/lace/lib/python3.11/site-packages/networkx/algorithms/dag.py", line 23, in <module>
    from fractions import gcd
ImportError: cannot import name 'gcd' from 'fractions' (/home/user/miniconda3/envs/lace/lib/python3.11/fractions.py)

Look at this compatibility table. fractions.gcd(a, b) has been moved to math.gcd(a, b) in Python 3.9. Either recent networkx version should be used or python version downgraded.

Best regards
Asan

@olgakozhar
Copy link

Hello Asan,

thanks for posting this. I tried python 3.4 and 3.8 but keep getting different errors. For example, with python 3.8 I got an error with numpy:

File "Lace-1.14.1/Lace/Lace_run.py", line 14, in
from Lace.BuildSuperTranscript import SuperTran
File "/home/user/miniconda3/envs/lace/lib/python3.8/site-packages/Lace/BuildSuperTranscript.py", line 11, in
import networkx as nx
File "/home/user/miniconda3/envs/lace/lib/python3.8/site-packages/networkx/init.py", line 117, in
import networkx.readwrite
File "/home/user/miniconda3/envs/lace/lib/python3.8/site-packages/networkx/readwrite/init.py", line 15, in
from networkx.readwrite.graphml import *
File "/home/user/miniconda3/envs/lace/lib/python3.8/site-packages/networkx/readwrite/graphml.py", line 314, in
class GraphML(object):
File "/home/user/miniconda3/envs/lace/lib/python3.8/site-packages/networkx/readwrite/graphml.py", line 346, in GraphML
(np.int, "int"), (np.int8, "int"),
File "/home/user/miniconda3/envs/lace/lib/python3.8/site-packages/numpy/init.py", line 305, in getattr
raise AttributeError(former_attrs[attr])
AttributeError: module 'numpy' has no attribute 'int'.
np.int was a deprecated alias for the builtin int. To avoid this error in existing code, use int by itself. Doing this will not modify any behavior and is safe. When replacing np.int, you may wish to use e.g. np.int64 or np.int32 to specify the precision.

I am wondering if you managed to run Lace with either downgraded python or a recent version of networkx?

Thanks,
Olga

@anthonysnead
Copy link

anthonysnead commented Jan 26, 2024

Hello,
Has anyone figured out how to fix this? I attempted to downgrade python to 3.8 and go through the code looking for np.int (because I got the same error), but I still could not fix this. I would love to use the SuperTranscript method on some nontrinity assemblies, but I cannot get the conda install to work and all the docker images are also broken.
Thanks
Anthony

@hempelc
Copy link

hempelc commented Aug 8, 2024

I was able to fix this by removing the version dependency for networkx in the environment.yml file, so if you edit the file before creating the environment and turn "- networkx=2.3*" into "- networkx", it works. This installed networkx 3.3 on my system, which removed the gdc-related error.

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

4 participants