Installing Cython/Statsmodels - python

I can not for the life of me figure out how to install the package statsmodels for Python 3. It feels like I've tried everything, but nothing is working.
Goal: import statsmodels in python
I start with:
pip install statsmodels
Main error messages:
Failed bulding wheel for statsmodels.
Cython is required to compile statsmodels from a development branch.
Please install Cython or download a source release of statsmodels.
So I try:
pip install cython
Gives:
Requirement already satisfied: cython in c:users\XXX\appdata\roaming\python\python36\site-packages
I installed cython by installing anaconda. I have tried almost all answers I could find by basic googling. But things just don't seem to be working.
Instead of listing the input\output of what I have tried I now only show the first steps, but let me know if you want to see the output of any commands.
How do I continue from here? Any help is appreciated, I've been trying to fix this for several days now and I'm only getting frustrated.
Right now I'm trying:
easy_install cython
This seemed to work, but afterwards pip install statsmodels didn't work.
Command ... failed with error code 1.
I tried:
git clone https://github.com/statsmodels/statsmodels
cd statsmodels
pip install .
And failed with a bunch of errors.

I ran into this same problem lastnight trying to install statsmodels. Finally what worked was installing the Microsoft Visual C++ compiler for Python found here: https://www.microsoft.com/en-gb/download/details.aspx?id=44266 then installing statsmodels by doing pip install statsmodels. I had already installed Cython by using pip. Though I do realize that was for Python 2.7. There doesn't seem to be this compiler available for Python 3.

The main statsmodels on PyPI is very old and uses a nonstandard setup. The release candidate for 0.10.0 is out now, and I would strongly recommend you use this one. You can install it using
pip install statsmodels=0.10.0rc2 --pre
It has wheels for all of the major platforms (Win/OSX/Linux), so you shouldn't see issues related to Cython.

To install statsmodels under anaconda, use
conda install statsmodels
The package is available in the repository of anacondata in version 0.8.0 which is the latest on pip as of now.
anaconda is not "just" a Python installation, it also contains the conda package manager that can install pre-built packages from the main repository of anaconda or from other "channels". It is not advisable to install packages that are available from the anaconda channel with pip, in general.
A comment on the issue of Cython here: to use Cython, your computer needs also a "development environment", that is the availability of a C compiler, of the Python development headers, among others. The C compiler must be compatible with the version of Python for which Cython is installed.

Related

Problem in installing ecapture in python 3.10

I was just preparing to make a voice assistant and an error occurred while I was installing the ecapture module in python. I used pip for installing and the error is as shown below.
Failed to build scikit-image
ERROR: Could not build wheels for scikit-image, which is required to install py.project.toml-based projects
I have tried to install it from PyPI
even I do have tried to restart my computer, reinstall python, etc.
but it doesn't just work.
Note: only use this answer if you trust binaries built by Christoph Gohlke, who maintains an excellent index of binaries here https://www.lfd.uci.edu/~gohlke/pythonlibs/
You can either grab the needed packages from there manually, or use this package (which I wrote, full disclosure):
pip install gohlkegrabber
ggrab . scikit-image
pip install scikit_image-0.19.0-cp310-cp310-win_amd64.whl
pip install ecapture
Note that the package you were lacking is scikit-image - you may be able to find binaries elsewhere as well, the site above is only provided as a suggestion. Again, only use if you trust the author.
Also note that the package was called scikit_image-0.19.0-cp310-cp310-win_amd64.whl for me, as I'm on Python 3.10 on 64-bit Windows. Yours may have a different name (if available), but the ggrab command will tell you.
Finally note that 0.19.0 just happens to be the most recent build on that site - it's not guaranteed to have the latest build, or to have the latest build for your OS/version of Python.

Can not get python to install Talos package

I've installed the latest python version 3.9.7 on my ubuntu 20.04 machine. I'm attempting to run some code that requires the Talos package, however I've attempted several times to install Talos using pip3. It does much of the work downloading and installing stuff, until it gets to something called "building wheel for scipy", and then after a lot of work, all I get is error messages. My first question is, is it possible that there is no version of Talos for 3.9.7, or that 3.9.7 is too advanced? If it should integrate Talos, how can I diagnose the problem so I can get it installed? Thx. J
This could be because the wrong version of Cython is being picked up. I have experienced this being the cause of scipy build errors in the past. I would try a pip3 install --upgrade cython first.

Pip Errors Out When Installing Anything

I've run into an odd issue where pip just won't work. I'm using the latest version of PyCharm, and I've tried both Python 3.8.10 and 3.9.6.
I've done clean installations of both, removed from PATH, reinstalled with new installer, reinstalled pip, etc.
The error code I run into appears no matter what library I am trying to download. I've tried PyAudio, PyGame, OpenCV-Python and others.
Pip was working fine a couple days ago, and no changes have been made to any files in that time.
Attempting to run pip install --upgrade pip does not have an effect.
I've been running off virtual enviroments with setuptools 40.8.0 and pip 21.1.3 installed.
The full error for installing PyAudio can be seen here: https://pastebin.com/iQmZwsRv
PyGame error: https://pastebin.com/WEF8uM2d
OpenCV-Python Error: https://pastebin.com/LuZq99Cu
Py- audio - it's not compatible with your Py charm I suppose due to the latest install updates, try to install it on the main environment. Also, try to downgrade your version of python as many dependencies are not compatible with your version of python as stated by error[it is not compatible with this Python]
Open Cv - Fails to build the wheel package as it is attributed also in error [CMake was unable to find a build program corresponding to "Ninja". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.]
May I know what build tool are you using?

How do I install python third party libs on the m1 chip?

The Mac Book Air M1 chip doesn't seem to support pep517 according to the errors of installing third-party libraries with pip or brew. Even using these methods without pep517 downloading the library locally didn't work. How does one circumvent this?
Error from using pip install pandas:
Failed to build numpy
ERROR: Could not build wheels for numpy which use PEP 517 and cannot be installed directly
I've tried this:
pip install <lib>
installing the library locally and trying to install with pip without pep517
brew install <lib>
openblas installation of lib
python env on the intel venv
I had the exact same problem, with a different library but with the same error code for PEP 517, I was using python 3.9 at the time, I checked the docs and found out that it's a problem with the python version for the library, downgraded to Python 3.6 and voila! it worked.
Basically try downgrading to Python 3.6 and check.
Installing python libraries through Anaconda seems to work. I simply downloaded the installer and could later use the libraries globally. If someone has a better in-depth explanation, feel free to comment.
I was having the same message when trying to install a different package. I solved by removing the CommandLineTools and installing it again. The steps were:
sudo rm -r /Library/Developer/CommandLineTools
wait for command prompt...
xcode-select --install
This solved the issue for me.

Problems installing TensorFlow on Mac

I am trying to follow to the installation guide on tensorflow.org and have installed Python version 2 again for that reason using Homebrew.
When I run the installation as described
$ pip install https://storage.googleapis.com/tensorflow/mac/tensorflow-0.5.0-py2-none-any.whl
I get this error message:
tensorflow-0.5.0-py2-none-any.whl is not a supported wheel on this platform.
I am obviously doing something wrong, but have no idea. Any clues?
I do not want to use virtualenv, since anaconda already comes with its own environment management conda. When installing the newest version 0.6.0 directly with pip install, I had a similar error. It seemed to not resolve the dependencies correctly.
Here is what you can try:
Install anaconda
Create a new conda workspace
Download the specific protobuf version that tensorflow needs: https://pypi.python.org/pypi/protobuf/3.0.0a3
Install it via sudo easy_install ~/Downloads/protobuf-3.0.0a3-py2.7.egg
Install a numpy version greater than 1.08.x via conda install numpy
Download the 0.6.0 version of tensorflow: https://storage.googleapis.com/tensorflow/mac/tensorflow-0.6.0-py2-none-any.whl
Install via pip install ~/Downloads/tensorflow-0.6.0-py2-none-any.whl
When you install tensorflow from the whl file directly, it should tell you when dependencies are not there. It seems not to be able to resolve these conflicts independently. My setup had issues with protobuf and numpy. After installing them manually everything worked fine.
I hope this helps!
It seems to be a common issue. Try to install it in the virtualenv. Its a much better solution, as you can always easily set up a new version of tensorflow without conflicts.
VirutalEnv Tutorial:
http://tensorflow.org/get_started/os_setup.md#virtualenv-based_installation
On the Mac, I didn't have any problem installing tensorflow with the anaconda version of python: https://www.continuum.io/downloads
The anaconda version also provides science, math, engineering, and data analysis packages. A lot of people on https://www.kaggle.com/ seem to use this...just a thought.

Categories

Resources