Closed nenasedk closed 3 years ago
Install ultranest from conda.
The command is in https://johannesbuchner.github.io/UltraNest/installation.html after "If you use conda, you can install UltraNest with:"
The cause is that the way cython code was compiled is incompatible with your architecture, so it needs to be recompiled. You can also get the code repository, and install locally. see https://johannesbuchner.github.io/UltraNest/installation.html#from-sources
To compile the cython code, python3 setup.py build_ext --inplace
can be useful.
This could be solved by building the cython extensions with https://github.com/scipy/oldest-supported-numpy
I ran into the same issue on a Linux machine. I tried python3 setup.py build_ext --inplace
but the problem remained.
Please report what conda install ultranest
followed by python3 -c 'import ultranest'
produces, in a fresh conda environment.
Please report what pip3 install ultranest
followed by python3 -c 'import ultranest'
produces, in a fresh conda environment.
Please report what python3 setup.py install
followed by python3 -c 'import ultranest'
produces, in a fresh conda environment.
For all tests I use a new conda env, using python 3.8 on macoS 10.14.6 I have not used the 'https://github.com/scipy/oldest-supported-numpy' as recommended above.
In a clean conda env, conda install ultranest
seems to install properly, there is no printed output after python3 -c 'import ultranest'
In a clean conda env pip3 install ultranest
failes to install, and instead produces a loop of the following error:
Using cached ultranest-3.2.0.tar.gz (21.4 MB)
ERROR: Command errored out with exit status 1:
command: /Users/nasedkin/anaconda3/envs/untest/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/zb/1kks1nb14h7_f6zq97b6sg8xxc6_b4/T/pip-install-rnrd2lm_/ultranest_3a6b8defbf954e308b5d06b1fd5417aa/setup.py'"'"'; __file__='"'"'/private/var/folders/zb/1kks1nb14h7_f6zq97b6sg8xxc6_b4/T/pip-install-rnrd2lm_/ultranest_3a6b8defbf954e308b5d06b1fd5417aa/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/zb/1kks1nb14h7_f6zq97b6sg8xxc6_b4/T/pip-pip-egg-info-721ertg1
cwd: /private/var/folders/zb/1kks1nb14h7_f6zq97b6sg8xxc6_b4/T/pip-install-rnrd2lm_/ultranest_3a6b8defbf954e308b5d06b1fd5417aa/
Complete output (5 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/zb/1kks1nb14h7_f6zq97b6sg8xxc6_b4/T/pip-install-rnrd2lm_/ultranest_3a6b8defbf954e308b5d06b1fd5417aa/setup.py", line 9, in <module>
from Cython.Build import cythonize
ModuleNotFoundError: No module named 'Cython'
The module is not imported, but no error is printed when running python3 -c 'import ultranest'
If I conda install cython
in the clean env before pip3 installing ultranest, the installation is sucessful, although there is an error:
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for ultranest
If I python3 setup.py install
ultranest from its directory in a clean env, on the up-to-date master branch, it throws an error, since cython is not installed. After conda installing cython, python3 -c 'import ultranest'
produces an error, since the requirements still need to be installed. After pip install -r pip-requirements.txt
, python3 -c 'import ultranest'
still produces an error:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/nasedkin/python-packages/ultranest/ultranest/__init__.py", line 7, in <module>
from .integrator import NestedSampler, ReactiveNestedSampler, read_file
File "/Users/nasedkin/python-packages/ultranest/ultranest/integrator.py", line 20, in <module>
from ultranest.mlfriends import MLFriends, AffineLayer, ScalingLayer, find_nearby, WrappingEllipsoid, RobustEllipsoidRegion
ModuleNotFoundError: No module named 'ultranest.mlfriends'
Using python3 setup.py build_ext --inplace
appears to have resolved this final error.
Thanks. In general people say it is not a good idea to mix pip and conda. I am closing this in favor of discussing solutions in #26. Patches are very welcome, if you have any time.
I created a new virtualenv
(using Python 3.8 on a Linux machine) and emptied the pip
cache. Then I installed cython
with pip
and afterwards UltraNest
. This gave the following error:
ultranest/mlfriends.c:612:10: fatal error: numpy/arrayobject.h: No such file or directory
612 | #include "numpy/arrayobject.h"
| ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for ultranest
But it finished the installation nonetheless:
Running setup.py install for ultranest ... done
Importing does not give an error anymore! Not quite sure what solved the issue but happy that it works now :).
Description
Describe what you were trying to get done.
Trying to import ultranest.
Tell us what happened, what went wrong, and what you expected to happen. There is a valueError upon import:
import ultranest