Closed yaronetokayer closed 4 weeks ago
hmm, this is strange – the error "Numpy is not present" appears when the setup.py script tries to import numpy
and encounters an ImportError
. It looks like running pip install
inside a pyenv
does not pick up the correct environment, can you try running python setup.py install
instead? (it may complain about this being an outdated procedure, but so far it has worked on all recent version of python).
A side note: the script correctly picked up OpenMP from homebrew; the two identical error messages resulted from various attempts to link against it, but finally it has found the correct configuration, as evidenced by the "-fopenmp" flags appearing in the later lines.
Another note is that on my machine (nearly identical setup, but using Anaconda rather than pyenv) I didn't manage to get it working with NumPy 2.0 due to conflicting versions of OpenMP (same problem as in #39); need further investigation. However, if you're not using Anacoda (which comes with its own libomp), you might be fine.
Thank you!
I ran python setup.py install
like you recommended from the Agama-master and the script ran without raising any issues related to NumPy (this was with Numpy 2.0.0).
It eventually finished and I am able to import agama into my python session!
A few notes and follow up questions (to the extent that they make sense - it's possible the questions will betray my own lack of understanding...):
1) While running the script, I got a few messages about gsl and eigen not being found, even though I do have those packages installed through homebrew. I replied Y
to install them now, but will this cause problems with having conflicting GSL and eigen installations? Or will the ones it installed just stay local in my Agama-master directory?
I was also asked about cvxopt and unsio, but I didn't already have those on my machine.
2) When I run pip list
, agama 1.0
is listed twice. Is that normal?
3) While I run pip list
, cvxopt 1.3.2
is shown, but not unsio
. Does this mean that one of these was installed in my environment site-packages, while the other was only installed in the Agama-master directory?
great that it worked, so I need to investigate why pip does not correctly capture the current pyenv setting.
Y
to install them now, but will this cause problems with having conflicting GSL and eigen installations? Or will the ones it installed just stay local in my Agama-master directory? I was also asked about cvxopt and unsio, but I didn't already have those on my machine. *in general, the setup script first tries to use existing versions of these libraries, but if for some reason this failed (I'm not sure why this happened in your case), it will download and compile them. I should make it clear that this does not interfere in any way with the existing ones, because these libraries (GSL, Eigen and UNSIO) are put into the extras
folder of the Agama distribution, and thus are only visible to the make
program that compiles Agama. These are C or C++ libraries, hence not visible to pip
(or any package manager – conda, homebrew, macports, etc., for that matter).
CVXOPT is a different story, because this is a Python extension module, and hence it gets installed in the same virtual environment as Agama itself (and should appear in pip list
).
pip list
, agama 1.0
is listed twice. Is that normal? *I'm not sure why this happens, but I've also seen it occasionally; seems to cause no harm.
pip list
, cvxopt 1.3.2
is shown, but not unsio
. Does this mean that one of these was installed in my environment site-packages, while the other was only installed in the Agama-master directory? *yes – see above.
As an FYI, you mentioned that after running python setup.py install
instead of pip install ./
, "it may complain about this being an outdated procedure, but so far it has worked on all recent version of python":
When I run pip from my pyenv virtual environment, I am indeed being given the warning you predicted:
DEPRECATION: Loading egg at /Users/yaronetokayer/.pyenv/versions/3.12.4/envs/halos-py3/lib/python3.12/site-packages/agama-1.0-py3.12-macosx-14.5-arm64.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation. Discussion can be found at https://github.com/pypa/pip/issues/12330
We're currently at pip 24.1.2
, so it looks like at some point another work around will be needed.
Thank you again for your help! I have been running agama without issue from my environment.
The installation script has been updated, and usually works fine when invoked both as python setup.py install
(deprecated) or as pip install .
; however, in some cases pip
may decide to use "isolated build environment", in which case you get the error "Numpy is not present". If the packages setuptools
, wheel
and of course numpy
are installed in the current virtual environment, this seems to prevent this problem, but if it appears, the solution is to use a flag --no-build-isolation
for pip
.
Dear Dr. Vasiliev,
I am encountering the following set of issues when attempting to install agama.
About my machine: I am running macOS Sonoma 14.5 with the Apple M2 Pro chip. I use pynev to manage my python versions. I am in a virtual environment that uses Python 3.12.4. I manage my packages with homebrew.
1) When I run 'pip install agama', I get the following error:
Note that this happens both when numpy 2.0.0 is installed and when I downgrade numpy. As an aside, a colleague who is attempting to install py-sphviewer on his Linux machine is encountering a similar issue, where he gets
ModuleNotFoundError: No module names 'numpy'
In case it's relevant, I have both libomp and open-mp as packages installed via homebrew...
2) Since this wasn't working, I tried a manual installation of Agama, and after tinkering around with the Makefile.local, was able to get 'make' to run without fatal errors and do a
pip install ./
from that local directory. However, once I did that, anytime I tried toimport agama
from python, my python kernel shut down. I got azsh: segmentation error
. This happened both when I would dopip install ./
from Agama-master, and when I would just add the Agama-master directory to the PYTHONPATH... In case it's helpful, I've attached my Makefile and Makefile.local files, which I modified.Thank you for your help!
agama_makefile_copy.txt agama_makefile_local_copy.txt