markovmodel / PyEMMA

🚂 Python API for Emma's Markov Model Algorithms 🚂
http://pyemma.org
GNU Lesser General Public License v3.0
307 stars 118 forks source link

Installation on M1 Mac #1524

Closed hl2500 closed 2 years ago

hl2500 commented 2 years ago

Hello,

I was trying to install pyemma with miniforge on m1 macbook, but I could not install the latest version. I used conda to install some dependencies first, like numpy, mdtraj, etc. Then used pip to install pyemma. The latest version I could install was 2.5.5. Is there anyway I can upgrade pyemma to a newer version? Thank you!

clonker commented 2 years ago

Hi, at least with pip this should not be a problem. The latest pip-available version is 2.5.10. Can you try to pip install pyemma==2.5.10 and report if there are any problems? Thanks!

hl2500 commented 2 years ago

Sorry for the late response. I tried that and here are some of the last few lines of the error message:

3 errors generated. error: command '/usr/bin/gcc' failed with exit code 1

ERROR: Failed building wheel for mdtraj Failed to build mdtraj ERROR: Could not build wheels for mdtraj, which is required to install pyproject.toml-based projects

ERROR: Could not find a version that satisfies the requirement pyemma==2.5.10 (from versions: 1.0a2, 1.0a3, 1.0, 1.0.1, 1.0.2, 1.1, 1.1.1, 1.1.2, 1.2, 1.2.1, 1.2.2, 2.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.1rc1, 2.1rc2, 2.1rc3, 2.1, 2.1.1, 2.2, 2.2.1, 2.2.2, 2.2.3, 2.2.4, 2.2.6, 2.2.7, 2.3, 2.3.1, 2.3.2, 2.4, 2.5, 2.5.1, 2.5.2, 2.5.3, 2.5.4, 2.5.5, 2.5.6, 2.5.7, 2.5.8, 2.5.9, 2.5.10) ERROR: No matching distribution found for pyemma==2.5.10

My mdtraj (1.9.7) was pre-install from conda-forge, because pip failed to build this package. I guess miniforge, which supports arm64, may not be compatible with the dependencies? Thanks!

clonker commented 2 years ago

Hey no problem! This is a bit curious. I don't think it is miniforge's fault and/or an incompatibility there, just dependencies which have not been compiled for M1 yet. The first issue to solve would be as far as i can tell installing mdtraj. It can help to start from a fresh environment, too:

conda create -n pyemma
conda activate pyemma
conda install python=3.9 cython numpy scipy compilers

conda deactivate
conda activate pyemma

pip install mdtraj msmtools bhmm deeptime

And finally to get the latest trunk version:

pip install git+https://github.com/markovmodel/pyemma.git@devel

Please don't hesitate to post full error messages here, they might be insightful (if too long you can also attach as txt file or similar). 🙂

Happy holidays!

hl2500 commented 2 years ago

Thank you for the suggestion! I tried with the commands above, but pip failed to build mdtraj, the error messages are in mdtraj_error.txt. Then I installed mdtraj with conda (miniforge) and tried the last command to install pyemma from github, but it seemed that pyemma ignored mdtraj already installed and tried to rebuild it, so it was not successful. Only version 2.5.5 worked for some reason.

Happy holidays!

clonker commented 2 years ago

That is very strange. It seems like pip is prioritizing its cache over the installed conda packages. You can try to invoke pip with the --no-deps flag so that only pyemma is pulled and built. The remaining dependencies you'll have to get from conda-forge though. Here is a list of requirements for running pyemma.

hl2500 commented 2 years ago

I installed all the dependencies and tried pip install --no-deps pyemma or pip install --no-deps git+https://github.com/markovmodel/pyemma.git@devel, but it still seemed to build mdtraj.

clonker commented 2 years ago

Argh. Guess this is because it's specified in the pyproject.toml file. I just tried it locally and what works is cloning the repository (git clone https://github.com/markovmodel/pyemma.git), change directory (cd pyemma) and run python setup.py install. This requires the environment to be active so that the correct dependencies are linked up.

hl2500 commented 2 years ago

There was an error when I tried this:

Searching for pyEMMA==2.5.10+2.gb46e895d Reading https://pypi.org/simple/pyEMMA/ /miniforge3/envs/pyemma_pensa/lib/python3.9/site-packages/pkg_resources/init.py:116: PkgResourcesDeprecationWarning: is an invalid version and will not be supported in a future release warnings.warn( No local packages or working download links found for pyEMMA==2.5.10+2.gb46e895d error: Could not find suitable distribution for Requirement.parse('pyEMMA==2.5.10+2.gb46e895d')

clonker commented 2 years ago

Can you post the full console output? Either as attachment or as markdown code block (surround by triple single quotation marks like ``). To be safe please run in a fresh environment and runpython setup.py clean` beforehand.

hl2500 commented 2 years ago

Thank you so much for the suggestions! This time there was no error and I could import pyemma successfully. I will try to run the tutorial notebooks to see if there are any issue.

lucl13 commented 2 years ago

Hi,

I followed the above procedure and installed pyemma manually using "python setup.py install". But I can't import successfully, it give the following error" ImportError: cannot import name 'logsumexp' from 'pyemma.thermo.extensions.util' (unknown location)". Any idea to fix it?

I am using M1 chip Mac.

Installation procedure:

conda create -n pyemma conda activate pyemma conda install python=3.9 cython numpy scipy compilers mdtraj

conda deactivate conda activate pyemma

pip install msmtools bhmm deeptime

git clone https://github.com/markovmodel/pyemma.git

cd pyemma python setup.py clean python setup.py install

clonker commented 2 years ago

Instead of running python setup.py install i suggest to try pip install . (while being in pyemma environment).

clonker commented 2 years ago

Ah nevermind, I think I know what is going on. You should change the directory to something else first (like go to your home directory or so), THEN start the python interpreter. Otherwise it is going to look locally to import pyemma, which is going to fail with exactly the error you observed.

lucl13 commented 2 years ago

Ah nevermind, I think I know what is going on. You should change the directory to something else first (like go to your home directory or so), THEN start the python interpreter. Otherwise it is going to look locally to import pyemma, which is going to fail with exactly the error you observed.

Exactly, I forgot to change the directory. Thanks.