a-r-j / graphein

Protein Graph Library
https://graphein.ai/
MIT License
1.02k stars 131 forks source link

Cannot install environment-dev.yml on CPU #112

Closed josephmaa closed 2 years ago

josephmaa commented 2 years ago

Describe the bug Cannot develop on MacOS Big Sur (11.5.2) on CPU.

To Reproduce Steps to reproduce the behavior:

  1. Run conda env create -f environment-dev.yml
  2. Error output:
    
    Solving environment: failed

ResolvePackageNotFound:

Expected behavior Expected installation of pytorch, cudatoolkit, pytorch3d

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Additional context Installation works with the normal environment.yml file. I tried independently installing through pytorch.org with the command conda install pytorch torchvision torchaudio -c pytorch, but after running the example code:

from graphein.protein.config import ProteinGraphConfig
from graphein.protein.graphs import construct_graph

config = ProteinGraphConfig()
g = construct_graph(config=config, pdb_code="3eiy")

Error output:

Traceback (most recent call last):
  File "bin/test.py", line 1, in <module>
    from graphein.protein.config import ProteinGraphConfig
  File "/Users/josephgmaa/miniconda3/envs/graphein/lib/python3.8/site-packages/graphein/__init__.py", line 7, in <module>
    from .protein import *
  File "/Users/josephgmaa/miniconda3/envs/graphein/lib/python3.8/site-packages/graphein/protein/__init__.py", line 2, in <module>
    from .config import *
  File "/Users/josephgmaa/miniconda3/envs/graphein/lib/python3.8/site-packages/graphein/protein/config.py", line 16, in <module>
    from graphein.protein.features.nodes.amino_acid import meiler_embedding
  File "/Users/josephgmaa/miniconda3/envs/graphein/lib/python3.8/site-packages/graphein/protein/features/__init__.py", line 5, in <module>
    from .sequence import *
  File "/Users/josephgmaa/miniconda3/envs/graphein/lib/python3.8/site-packages/graphein/protein/features/sequence/__init__.py", line 1, in <module>
    from .embeddings import *
  File "/Users/josephgmaa/miniconda3/envs/graphein/lib/python3.8/site-packages/graphein/protein/features/sequence/embeddings.py", line 26, in <module>
    import biovec
  File "/Users/josephgmaa/miniconda3/envs/graphein/lib/python3.8/site-packages/biovec/__init__.py", line 1, in <module>
    from biovec import models
  File "/Users/josephgmaa/miniconda3/envs/graphein/lib/python3.8/site-packages/biovec/models/__init__.py", line 1, in <module>
    from biovec.models.prot_vec import *
  File "/Users/josephgmaa/miniconda3/envs/graphein/lib/python3.8/site-packages/biovec/models/prot_vec.py", line 1, in <module>
    from gensim.models import word2vec
  File "/Users/josephgmaa/miniconda3/envs/graphein/lib/python3.8/site-packages/gensim/__init__.py", line 5, in <module>
    from gensim import parsing, corpora, matutils, interfaces, models, similarities, summarization, utils  # noqa:F401
  File "/Users/josephgmaa/miniconda3/envs/graphein/lib/python3.8/site-packages/gensim/corpora/__init__.py", line 6, in <module>
    from .indexedcorpus import IndexedCorpus  # noqa:F401 must appear before the other classes
  File "/Users/josephgmaa/miniconda3/envs/graphein/lib/python3.8/site-packages/gensim/corpora/indexedcorpus.py", line 15, in <module>
    from gensim import interfaces, utils
  File "/Users/josephgmaa/miniconda3/envs/graphein/lib/python3.8/site-packages/gensim/interfaces.py", line 19, in <module>
    from gensim import utils, matutils
  File "/Users/josephgmaa/miniconda3/envs/graphein/lib/python3.8/site-packages/gensim/matutils.py", line 1054, in <module>
    from gensim._matutils import logsumexp, mean_absolute_difference, dirichlet_expectation
  File "__init__.pxd", line 198, in init gensim._matutils
ValueError: numpy.ndarray has the wrong size, try recompiling. Expected 88, got 96
a-r-j commented 2 years ago

Hey @josephmaa would recommend avoiding the conda environment file for now.

I’d instead fork, clone, create and env, run pip install -e . to install the package in editable mode. You can also install pip install -e .[all] (or similar) to install the additional dev dependencies

There’s also a devcontainer/Dockerfile you can use

EDIT: For future readers, this was most likely caused by installing the dev environment, which contains GPU builds of torch etc, on a Mac.