I'm trying to install numpy under Python 3.3.0 running Mac OS 10.7.5 (Lion) and using the compilers that come with Xcode 4.5.1. I installed Python 3 and gfortran using homebrew without any hiccups, but pip3 install numpy fails. Looking at other suggestions online, I tried setting Clang as the C compiler using:
export CC=clang
export CXX=clang
export FFLAGS=-ff2c
but received the same error. The final line reports ValueError: underlying buffer has been detached, and I posted the full output.
So, instead I tried building directly from source using the instructions from SciPy.org. This appears to succeed; the build and install processes run to completion, although they are not shy about reporting warnings. The full log is again available as a Gist. I can then run numpy.test('full') from Python 3, and although there are some warnings about unclosed files that I don't understand, it reports that all tests pass.
Does anyone know why pip fails to build NumPy when I can apparently do it manually without a problem?
It looks like numpy now provides wheels on pypi, which should install correctly without needing to compile anything locally on your machine when using pip.
Related
I'm having trouble installing packages and using them in Pycharm. I've followed various threads (I'm new to Macs and seem to have tried everything) now I'm stuck.
In this case, I want to use the package xgboost.
I have brew installed, after launching a terminal using Rosetta:
%brew install xgboost
Warning: xgboost 1.3.3 is already installed and up-to-date.
It appears installed OK here:
/opt/homebrew/Cellar/xgboost
I also have Python installed here:
/opt/homebrew/Cellar/python#3.9
But no matter how I configure an Interpreter in Pycharm, I can't seem to get the package recognised.
Where have I gone wrong?
I am very unsure exactly how, but I've got this working.
Following: https://abbasegbeyemi.me/blog/homebrew-python-apple-m1
I changed the order of elements in my path:
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/homebrew/bin
then a new interpreter in Pycharm using:
usr/local/Cellar/Python#3.9/3.9.2_2/bin/python3.9
Now I can install packages just using pip in pycharm and it works.
This has been 6 hours of pain - warning to anyone who isn't well versed in macs, setting up an M1 for python dev was a complete nightmare for me.
Docs: https://xgboost.readthedocs.io/en/latest/build.html
Pre-built binary wheel for Python
If you are planning to use Python, consider installing XGBoost from a pre-built binary wheel, available from Python Package Index (PyPI). You may download and install it by running
# Ensure that you are downloading one of the following:
# * xgboost-{version}-py2.py3-none-manylinux1_x86_64.whl
# * xgboost-{version}-py2.py3-none-win_amd64.whl
pip3 install xgboost
I was trying to install pandas using this command:
python -m pip install pandas
Installation starts initially but then goes all red and returns this error:
Could not install packages due to an OSError: [WinError8] Not enough storage is available to process this command
--- Logging error ---
I don't think it's a memory issue because I checked usage and it was at a normal level.
I'm using Python 3.7 on Windows 7.
Any suggestions on how to fix it??
Eureka! I'm posting solution in case anyone encounters the same problem in the future.
After hours of trying a lot of different solutions I have finally succeed even though I still don't know what was the source of this problem.
To install pandas in case of facing error while downloading using pip command first download manually .whl files of pandas from PyPI website:
https://pypi.org/project/pandas/#files
Copy it to the folder that is used as your path in cmd console- don't change name of the file.
In cmd console use:
python -m pip install fullnameofthedownloadedfile.whl --no-deps
Use --no-deps as it's very likely that automatically downloaded dependencies will encounter similar errors during downloading as pandas- you will install them manually instead.
Once this is finished repeat process for numpy and dateutil and any other packages that might be required.
What a relief!!! Happy coding;)
Since I've upgraded my MacOs to Big Sur I'm having some trouble with my data science libraries. I was able to install the numpy and pandas (even though it took an unusual amount of time as stated at this topic). But can't manage to install the Matplotlib.
I've tried three things...
First with the default MacOs embedded Phyton 3.8.2 .
Reinstalled numpy, upgraded pip, but when I've tried to install Matplotlib. I've got the following error:
RuntimeError: Polyfit sanity test emitted a warning, most likely due to using a buggy Accelerate backend. If you compiled yourself, see site.cfg.example for information. Otherwise report this to the vendor that provided NumPy.
RankWarning: Polyfit may be poorly conditioned
Later, I've seen some suggestions here at stackoverflow for similar problems, one suggested to use homebrew, so I've installed Python 3.9.0 through brew. However, when I've tried to install Matplotlib, still got a giant error, when it was trying to install Pillow:
(.......) The headers or library files could not be found for jpeg,a required dependency when compiling
Pillow from source.Please see the install instructions at:
https://pillow.readthedocs.io/en/latest/installation.html
ERROR: Command errored out with exit status 1: /usr/local/opt/python#3.9/bin/python3.9 (...)
To finish (in almost despair) I've tried to create a virtual environment using venv (& Python 3.8.2) and was able to install NumPy successfully, however, I've got the following error trying to install Matplotlib:
(...... long line of code....) The package setup script has attempted to modify files on your system
that are not within the EasyInstall build area, and has been aborted.
This package cannot be safely installed by EasyInstall, and may not
support alternate installation locations even if you run its setup
script by hand. Please inform the package's author and the EasyInstall
maintainers to find out if a fix or workaround is available.
Really don't know what to do... Is it impossible to use Matplotlib with a clean install on BigSur? hahaha =(
I did it!!! I fix it!!
For this error :
RuntimeError: Polyfit sanity test emitted a warning, most likely due to using a buggy Accelerate backend.
If you compiled yourself, see site.cfg.example for information. Otherwise report this to the vendor that provided NumPy.
RankWarning: Polyfit may be poorly conditioned
I fixed installing an older numpy version.
pip3 install --force-reinstall numpy\<1.19
It did the job.
For the second error:
(.......) The headers or library files could not be found for jpeg,a required dependency when compiling
Pillow from source.Please see the install instructions at: https://pillow.readthedocs.io/en/latest/installation.html
ERROR: Command errored out with exit status 1: /usr/local/opt/python#3.9/bin/python3.9 (...)
It was the missing JPEG library. I do recommend you guys install homebrew.
Solved this problem with:
brew install libjpeg
your easy_install is outdated.so just update your setup_tools by excuting following command:
pip install setuptools==51
then
easy_install --version
make sure your easy_install's version is above 51.
During the installation phase, I get this, "Unable to find vcvarsall.bat" error. The installation process did complete, though. However, I was unable to see the shell on my desktop (I am using windows) and neither was I able to open it manually. I scoured the internet for the error but was unable to find any solution for this case.
The installation process is through a superpack that downloads Python 2.7
SimpleCV is not receiving much love in the past few years, and most of it's code don't got upgrade like the libraries it depends on.
The problem you got is the Superpack trying to compile an older version of OpenCV.
When running the Superpack, you should have seen and redtext error, and if you try to run a code it should show you something like this:
File "C:\Python27\lib\site-packages\SimpleCV\base.py", line 59, in <module>
raise ImportError("Cannot load OpenCV library which is required by SimpleCV")
ImportError: Cannot load OpenCV library which is required by SimpleCV
There are a few paths you can try from there:
1. You can try to install Microsoft Visual C++ Compiler for Python 2.7
Uninstall everything SuperPack installed in your PC or it may not work
It may fixes some other uses when using pip.
Now you have to install SimpleCV again.
2. Try to install OpenCV(2.3) on your own:
You can use pip for it, just remember to chose 32bits to keep compatibility with (Super Pack)
Just run on CMD
pip install OpenCV or python -m pip install OpenCV
3. Give up on SuperPack and install everything on your own.
You can try this guide
https://github.com/sightmachine/SimpleCV#windows-7vista
Or use pip for all dependencies
numpy (Numpy+MKL make sure to install this one first)
scipy
PIL
ipython
svgwrite
pygame==1.9.1release
OpenCV
You can find a useful list of wheels here
http://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv
Sources:
https://blogs.msdn.microsoft.com/pythonengineering/2016/04/11/unable-to-find-vcvarsall-bat/
http://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv
https://github.com/sightmachine/SimpleCV#windows-7vista
Before I get to far into this, I should note that I have seen a very similar question, but the solution presented did not work for me. Perhaps one reason why is because that was Linux build and my current difficulty is on a Windows 7 machine. I use Cygwin to get access to the gcc (5.2.0) compiler suite.
In any event, I have been attempting to try out Stan via PyStan. I am working with an Anaconda (2.4.1 64-bit) distribution which I just updated today (Python 2.7.11). I initially tried to install PyStan via pip, but the install keeps failing due to what looks like the following error:
Cannot build msvcr library: "msvcr90d.dll" not found
Consequently, I used conda instead, which seemed to install just fine. (I should note that the conda install pushed my numpy back to an earlier version, which created conflicts with the pandas upon import. I just updated anaconda to deal with these broken dependencies.) I was also able to import PyStan without any problems. However, when I actually tried to fit a model (inside of a Jupyter Notebook), the process failed with the exception in the title.
The first thing I did was confirm that gcc was where in the referenced location (not shown in the title). Indeed it was, and it seemed to working just fine. I then tried to run the model as a script from the command line (still using Python), and it failed with the same error. When I recreated the model via the REPL, it pointed to a different location that had a .bat file referencing the (verified) compiler, and that failed as well.
I am pretty sure this is because I have Visual Studio 2012, instead of Visual Studio 2008. While it is possible for me to run parallel installations, if this code is going to be useful for others in the future, these are not reasonable hoops to jump through to make it happen. I was hoping that someone else might have a better explanation. Any info would be greatly appreciated.
Beneficial from the post at https://github.com/stan-dev/pystan/issues/306
I have met various error message, but finally, I install PyStan successfully.
My machine is also on Windows 7, x64 with Anaconda3 installed.Here are the procedures to install PyStan from the sourced codes.
Install Visual Studio 2017 & Visual Studio C++ Build Tool 2015 at http://landinghub.visualstudio.com/visual-cpp-build-tools
Update Conda
conda update conda
conda update --all
check the dependencies
pip install setuptool
conda install numpy cython matplotlib scipy pandas
Install gcc compiler components
conda install libpython
conda install -c msys2 m2w64-toolchain=5.3.0
created distutils.cfg file inside Anaconda3\Lib\distutils folder with the following:
[build]
compiler = mingw32
Download Git at https://git-scm.com/downloads
git clone --recursive https://github.com/stan-dev/pystan.git
Compile from the source code
python setup.py build --compiler=mingw32
python setup.py install
P.S. The solution for the issue: Cannot build msvcr library: "vcruntime140d.dll" not found.
Copy vcruntime140d.dll from C:\Windows\System32 to any folder, which is reachable in the path in the advanced system settings/environment variables/ system variables.