PMEAL / OpenPNM

A Python package for performing pore network modeling of porous media
http://openpnm.org
MIT License
454 stars 174 forks source link

OpenPNM is not available on ARM64 #2822

Closed alimansourieh closed 1 year ago

alimansourieh commented 1 year ago

Dear developer team,

I hope you are doing great. I am writing to report a problem I faced when I wanted to install openPNM package on Mac (M2 chip).

** When I install it from conda forge and the installation completes, I receive this error when I import openPNM in Python: import openpnm

Traceback (most recent call last):

File "", line 1, in

File "/Users/alimns/anaconda3/envs/myenv/lib/python3.11/site-packages/openpnm/init.py", line 64, in

from . import algorithms

File "/Users/alimns/anaconda3/envs/myenv/lib/python3.11/site-packages/openpnm/algorithms/init.py", line 13, in

from .GenericTransport import GenericTransport

File "/Users/alimns/anaconda3/envs/myenv/lib/python3.11/site-packages/openpnm/algorithms/GenericTransport.py", line 102, in

class GenericTransport(GenericAlgorithm):

File "/Users/alimns/anaconda3/envs/myenv/lib/python3.11/site-packages/openpnm/algorithms/GenericTransport.py", line 217, in GenericTransport

@docstr.get_full_descriptionf(base='GenericTransport.reset')

 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/Users/alimns/anaconda3/envs/myenv/lib/python3.11/site-packages/docrep/decorators.py", line 127, in deprecated

return func(self, *args, **kwargs)

       ^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/Users/alimns/anaconda3/envs/myenv/lib/python3.11/site-packages/docrep/init.py", line 991, in get_full_descriptionf

return self.get_full_description(base=args[0], *args[1:], **kwargs)

                                      ~~~~^^^

IndexError: tuple index out of range

**When I install it from pip, I do not receive an error but when I check the version of installed openPNM, it shows 2.7.0. Could the M2 chip be a potential issue? Your insights would be greatly appreciated.

Warm regards, Ali

jgostick commented 1 year ago

Were you installing into an old/existing env, or did you create a new one with conda create -n my_pnm_env -c conda-forge openpnm? The error messages you're getting look like old versions of various packages are lingering around.

alimansourieh commented 1 year ago

Were you installing into an old/existing env, or did you create a new one with conda create -n my_pnm_env -c conda-forge openpnm? The error messages you're getting look like old versions of various packages are lingering around.

Hello Professor Gostick. I created a new environment and just got the same error when I import it in python. When I open anaconda to check if it is installed in the environment, version 2.4.2 is installed. However I can not import it!

jgostick commented 1 year ago

version 2.4.2 is old...we are on 3+ now. Something is causing your system to install an old/conflicted version. I think there are other people using macs with M processors, so not sure if this is the problem or not.

BTW, after you created the new env and installed it, did you activate it? Are you sure spyder or whatever IDE you're using is using the new env? I don't use the anaconda navigator because it's so slow, but it is a good way to 'see' what is happening. If you created a new env, you can use the anaconda navigator to install spyder into that env, then open that specific install of spyder, and it should see your new env by default. There are other ways to do this but through navigator is probably the easier place to start.

alimansourieh commented 1 year ago

version 2.4.2 is old...we are on 3+ now. Something is causing your system to install an old/conflicted version. I think there are other people using macs with M processors, so not sure if this is the problem or not.

BTW, after you created the new env and installed it, did you activate it? Are you sure spyder or whatever IDE you're using is using the new env? I don't use the anaconda navigator because it's so slow, but it is a good way to 'see' what is happening. If you created a new env, you can use the anaconda navigator to install spyder into that env, then open that specific install of spyder, and it should see your new env by default. There are other ways to do this but through navigator is probably the easier place to start.

I created the new environment in the Mac terminal, and I activated it. then I got that error. However, When I try Spyder (based on your instructions), I get the same error.

alimansourieh commented 1 year ago

Dear Developer Team,

I am writing to give you an update. In my latest try, I created a new environment and installed another Python version (3.9.10), which works well on my Windows PC. Still, unfortunately, the installation was unsuccessful on Mac. I look forward to hearing from you.

Kind Regards, Ali

ivonindima commented 1 year ago

Dear Developer Team,

I am writing to give you an update. In my latest try, I created a new environment and installed another Python version (3.9.10), which works well on my Windows PC. Still, unfortunately, the installation was unsuccessful on Mac. I look forward to hearing from you.

Kind Regards, Ali

I am successfully using OpenPNM on a Mac with an M1 chip. The working configuration includes miniconda 4.10.1 (Intel x86) and Python 3.8.5. I suggest you try installing miniconda (Intel x86) instead of ARM.

alimansourieh commented 1 year ago

Dear Developer Team,

I am writing to give you an update. In my latest try, I created a new environment and installed another Python version (3.9.10), which works well on my Windows PC. Still, unfortunately, the installation was unsuccessful on Mac. I look forward to hearing from you.

Kind Regards, Ali

I am successfully using OpenPNM on a Mac with an M1 chip. The working configuration includes miniconda 4.10.1 (Intel x86) and Python 3.8.5. I suggest you try installing miniconda (Intel x86) instead of ARM.

Dear Dmitry,

Thank you for your reply. I installed Anaconda for intel processors (not for ARM) and finally could install the openPNM package. Thank you for your helpful response.

However, it is not efficient to install Anaconda (x86) on the Apple m2 pro chip because it is not natively running on the chip and uses the Rosetta emulator which reduces the performance and is much slower than a Windows PC.

jgostick commented 1 year ago

Your laptop is not the place to be doing compute intensive simulations anyway. You'll want to get your script/code working there, then move on to a big machine with real power, so I guess this solution is the way to go.

ma-sadeghi commented 1 year ago

@alimansourieh have you tried pip instead of conda?

alimansourieh commented 1 year ago

Your laptop is not the place to be doing compute intensive simulations anyway. You'll want to get your script/code working there, then move on to a big machine with real power, so I guess this solution is the way to go.

Thank you for your feedback. I completely agree that using my laptop for compute-intensive simulations isn't ideal. I'll focus on getting the script/code working locally and then transition to a more powerful machine for the simulations.

alimansourieh commented 1 year ago

@alimansourieh have you tried pip instead of conda?

Yes I did. When I install it from pip, I do not receive an error but when I check the version of installed openPNM, it shows 2.7.0.!

jgostick commented 1 year ago

getting 2.7 would be a dependency getting pinned by some other package. Try with a fresh env?

alimansourieh commented 1 year ago

getting 2.7 would be a dependency getting pinned by some other package. Try with a fresh env.

Yes. I tried to install it using pip in a new environment but this problem was not solved. By installing anaconda (for intel chips rather than M1/M2), both installing methods ( pip or conda forge are working. So, I guess there may be a compatibility issue with these chips.

jaimergp commented 1 year ago

With conda 23.9 you can create environments for other platforms, without reinstalling Mini/Ana-conda for a different architecture.

This should work:

$ conda create -n openpnm-intel openpnm=3 --platform=osx-64
ma-sadeghi commented 1 year ago

With conda 23.9 you can create environments for other platforms, without reinstalling Mini/Ana-conda for a different architecture.

This should work:

$ conda create -n openpnm-intel openpnm=3 --platform=osx-64

@alimansourieh Can you try this? @jaimergp Thanks! Is this going to be a native arm64 installation or an emulation?

jaimergp commented 1 year ago

That's for creating an Intel environment in a M1/2 machine. It will run it via emulation.

ma-sadeghi commented 1 year ago

I see. Is there a way to do a native build?

ma-sadeghi commented 1 year ago

I see. Is there a way to do a native build?

Following the discussion with @jaimergp, it seems that pypardiso was the culprint as it's not (and will not be) available on ARM64. This is now fixed in #2835, but conda-forge builds are not yet updated. PyPI though should be fine.

I tested pip install openpnm on an ARM64 Macbook and sure enough openpnm.__version__ shows 3.3.0, which is the latest version. Since PyPI is now fixed, I'm closing this issue. conda-forge should be updated in a day or two.

@alimansourieh Try pip install openpnm and it should work now. Also, make sure you have an ARM64 Python interpreter (e.g., from Anaconda).

ma-sadeghi commented 1 year ago

conda-forge builds are also now available. I tested locally and it works.

alimansourieh commented 1 year ago

I see. Is there a way to do a native build?

Following the discussion with @jaimergp, it seems that pypardiso was the culprint as it's not (and will not be) available on ARM64. This is now fixed in #2835, but conda-forge builds are not yet updated. PyPI though should be fine.

I tested pip install openpnm on an ARM64 Macbook and sure enough openpnm.__version__ shows 3.3.0, which is the latest version. Since PyPI is now fixed, I'm closing this issue. conda-forge should be updated in a day or two.

@alimansourieh Try pip install openpnm and it should work now. Also, make sure you have an ARM64 Python interpreter (e.g., from Anaconda).

@ma-sadeghi I am sorry for the delayed response. Great! Thank you for your support.

ma-sadeghi commented 1 year ago

@alimansourieh I should warn you though that scipy's spsolve is very slow, up to 30x slower than pypardiso. So in the end, it might be better that you use the emulation so you can use pypardiso.

alimansourieh commented 1 year ago

@alimansourieh I should warn you though that scipy's spsolve is very slow, up to 30x slower than pypardiso. So in the end, it might be better that you use the emulation so you can use pypardiso.

@ma-sadeghi Thank you. So, it seems that windows is preferable than Mac.

ma-sadeghi commented 1 year ago

I think if you use the emulated version on Mac it should be equally fast