Closed klaykulik closed 4 years ago
Yes, the current sherpa install scripts require numpy to be available in the environment already. That's because the setup.py
uses setup
from numpy.disutils
, thus numpy needs to be installed when the setup is run.
We are working on changes to the package that will solve this in the future (#782, #784), but for now you simply have to install numpy in some way before you install sherpa (e.g. pip install numpy
before you call pip install sherpa
).
Thanks for the reply.
Pip still does not install sherpa after numpy is installed. In the initial issue, I tried to pip install sherpa
. It asked for numpy, which I installed (see the pip freeze output). Even after this, pip install sherpa
still errors out and says please install bison.
There is nothing mentioned in the installation instructions about installing bison. I don't see why pip requires bison to install sherpa, but conda can install it easily.
Bison is needed for a source install and I think that's happening here with pip (There are no binary wheels for sherpa on pypi ). You can see all the output from the ./configure
script in the terminal output you pasted.
On the other hand, conda just downloads the compiled sherpa and the dependencies, so the conda version does not care if a compiler or tools like bison are available on the system.
Thanks you for reporting; it's not always easy to know how users actually use sherpa "in the wild". May I ask if this is something you just came across by chance or is it important for you to be able to install sherpa from with pip (instead of conda)?
Sorry, I should have added that bison is not a Python package, it's part of the usual system compiler tools together with the gcc compiler etc.
Okay that makes sense, thanks!
I had planned on using sherpa as a requirement in a package I'm working on, and found the issue when trying to pip install the package's requirements in a new env. I must have used conda to install it while developing, and just noticed the issue now while testing the install of my package.
The pip-installation section at https://sherpa.readthedocs.io/en/latest/install.html#using-pip should be updated (probably to say "please follow the source-installation" instructions).
@klaykulik : How much of a problem is the current behaviour for you, or in other words, how hard should we work to fix this? (Just trying to a a vote from you as a "user" to help guide if we should focus our work in installation, or new features, or improved plotting etc...
It's not a big deal, I can work around it. I just wanted to make sure you were aware of the issue.
Thanks again!
We have just merged #782 into master which means pip
will now install numpy
along with sherpa
. This doesn't help if you do not have a compiler or one of the other tools needed to build Sherpa. I don't know at what point support in the tooling for identifying requirements (e.g. for bison or an equivalent) stops and it becomes a documentation issue.
Hello, I am still having trouble to install sherpa by using pip. I am trying to use it in Google Colab, I don't know if this might be the problem or if I should install something else.
@ThaisGuerini - is there any information on why it failed?
@DougBurke thanks for replying. The error message is the following:
Collecting sherpa Downloading https://files.pythonhosted.org/packages/49/6a/6da658a35d7f0e1b70353a7bef8f15488629448fae2ddb259ff8008c7070/sherpa-4.12.2.tar.gz (12.0MB) |████████████████████████████████| 12.0MB 334kB/s Installing build dependencies ... done Getting requirements to build wheel ... done Preparing wheel metadata ... done Requirement already satisfied: numpy in /usr/local/lib/python3.6/dist-packages (from sherpa) (1.18.5) Building wheels for collected packages: sherpa Building wheel for sherpa (PEP 517) ... error ERROR: Failed building wheel for sherpa Running setup.py clean for sherpa Failed to build sherpa ERROR: Could not build wheels for sherpa which use PEP 517 and cannot be installed directly
Well, that's not particularly helpful!
My guess is that you are missing one of the compilation tools we need (possibly flex or bison but you also need gcc, g++, and make). There's a note about it at https://sherpa.readthedocs.io/en/latest/install.html#building-from-source but it's not obvious how to tell python these non-python requirements (unless it's in PEP 517 or related and we just don't take advantage of it).
You could try
% mkdir temp
% cd temp
% pip download sherpa
% tar xzf sherpa-4.12.2.tar.gz
% cd sherpa-4.12.2
% python setup.py install
and see if that gives useful information. Or use the --log option to pip install
but I think that is very verbose and hard to parse (at least when I've tried)
Sorry to bother you again.
I tried what you suggested, but I couldn't understand what went wrong. I don't know if you find it helpful, but the error message was:
UsageError: Line magic function %tar
not found.
Are you running this from within an ipython or jupyter notebook? If so, is this a local environment or something like Google's colab?
I am running it from the Google's Colab website.
What you would have needed to do was run the commands with each line starting with a ! as they are shell commands, not python.
Unfortunately, the colab system doesn't contain the necessary tools to build Sherpa - you would see an error like the following if you had unpacked the directory
!python setup.py install
...
... quite a lot of screen output
...
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking whether make supports the include directive... yes (GNU style)
checking dependency style of gcc... gcc3
checking for bison... no
checking for byacc... no
checking for yacc... no
configure: error: bison/byacc/yacc not found.
Please install bison
configure: error: ./configure failed for region-4.11
I don't have experience with colab to know if there's ways to install software or to add the conda package manager.
@hamogu - I believe you have 'Google colab' knowledge that may be useful here.
Try this in colab to get conda:
!wget https://repo.continuum.io/miniconda/Miniconda3-4.5.4-Linux-x86_64.sh && bash Miniconda3-4.5.4-Linux-x86_64.sh -bfp /usr/local
Then, install whatever conda packages you want with conda:
!conda install -y -q sherpa
Because you can't activate the conda environment from within colab, you have to manually add the path. I use the following, you might get away with not adding all of them, that depends on what other packages are installed, but there is no harm in listing too many packages, so I'll just give you what I use:
%env PATH /usr/local/pkgs/cfitsio-3.470-h14c3975_0/lib/:/usr/local/nvidia/bin:/usr/local/cuda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/tools/node/bin:/tools/google-cloud-sdk/bin:/opt/bin
%env LD_LIBRARY_PATH /usr/local/lib:/usr/local/nvidia/lib:/usr/local/nvidia/lib64
Note however, that this is not an officially support way of using Sherpa. We're happy to hear feedback from you and will try to help, but we many not have solutions to all problems you could encounter.
I forgot, in colab, always install python=3.6 in conda calls, so that all packages match the python version that colab runs on:
!conda install -y -q python=3.6 sherpa
@hamogu I tried what you suggested, but, unfortunately, I got an error message telling me the package isn't available. I am going to try to do what I need using other packages. Thank you anyway.
I don't know what's different for you - but here is an example that works for me: https://colab.research.google.com/drive/1IkqH2fy9ESBBFt7fHLunRAQVTbaMDzMk?usp=sharing Note that in this example I'm not just installing sherpa, but all of the Chandra software: CIAO, etc.
You have not told us much about your use case, so it's hard to give advice beyond of exact question "How do I install ...?". However, let me just say that Sherpa is of course made for a specific use case (fitting of X-ray data) where I think it's capabilities are almost unique in the Python world. On the other hand, Sherpa is also good for other things (fitting other spectra or any data really). In that capacity, Sherpa is not unique. There are certainly other packages to do that and if that's what you are looking for, then I would not necessarily bother with Sherpa if the installation is a headache for you.
Since you indicated that you are going to try other packages, I'm going to close this issue, but feel free to re-open if you have any follow-up questions.
Sherpa does not seem to want to install on a clean venv using Pip, but installs fine with conda.
Commands Only:
Commands and output/errors: