pandas fails to install if Cython is not installed
See original GitHub issueProblem description
Trying to install pandas using pip3 (and Python-3.6.6), I get:
% pip3 install pandas
Collecting pandas
Using cached https://files.pythonhosted.org/packages/e9/ad/5e92ba493eff96055a23b0a1323a9a803af71ec859ae3243ced86fcbd0a4/pandas-0.23.4.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-xaf0phg7/pandas/setup.py", line 38, in <module>
ver = Cython.__version__
AttributeError: module 'Cython' has no attribute '__version__'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-xaf0phg7/pandas/
Note, that Cython is available – the version installed with Python itself, not as a pip. The work-around is to pip3 install Cython
first:
% pip3 install Cython
Collecting Cython
Downloading https://files.pythonhosted.org/packages/21/89/ca320e5b45d381ae0df74c4b5694f1471c1b2453c5eb4bac3449f5970481/Cython-0.28.5.tar.gz (1.9MB)
100% |################################| 1.9MB 4.0MB/s
Installing collected packages: Cython
Running setup.py install for Cython ... done
Successfully installed Cython-0.28.5
% pip3 install pandas
Collecting pandas
Using cached https://files.pythonhosted.org/packages/e9/ad/5e92ba493eff96055a23b0a1323a9a803af71ec859ae3243ced86fcbd0a4/pandas-0.23.4.tar.gz
Collecting python-dateutil>=2.5.0 (from pandas)
Using cached https://files.pythonhosted.org/packages/cf/f5/af2b09c957ace60dcfac112b669c45c8c97e32f94aa8b56da4c6d1682825/python_dateutil-2.7.3-py2.py3-none-any.whl
Collecting pytz>=2011k (from pandas)
Using cached https://files.pythonhosted.org/packages/30/4e/27c34b62430286c6d59177a0842ed90dc789ce5d1ed740887653b898779a/pytz-2018.5-py2.py3-none-any.whl
Requirement already satisfied: numpy>=1.9.0 in /prod/pfe/local/lib/python3.6/site-packages (from pandas) (1.15.1)
Requirement already satisfied: six>=1.5 in /prod/pfe/local/lib/python3.6/site-packages (from python-dateutil>=2.5.0->pandas) (1.11.0)
Installing collected packages: python-dateutil, pytz, pandas
Running setup.py install for pandas ... done
Successfully installed pandas-0.23.4 python-dateutil-2.7.3 pytz-2018.5
but it should not be necessary, should it be? And if for some reason it is necessary, pandas needs to explicitly require it…
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:8 (4 by maintainers)
Top Results From Across the Web
How to solve import error for pandas? - python - Stack Overflow
Instead of installing it with conda or pip, try to install it with your package manager: sudo apt-get install python3-pandas.
Read more >Installation — pandas 0.12.0 documentation - PyData |
Make sure you have Cython installed when installing from the repository, rather then a tarball or pypi. On Windows, I suggest installing the...
Read more >ModuleNotFoundError: No module named 'Cython' in Python
The Python "ModuleNotFoundError: No module named 'Cython'" occurs when we forget to install the Cython module before importing it or install it ...
Read more >Error installing pandas on a Mac in python 3
OK, it is kind of long. I just want to mention that I installed a couple of other packages with no problem. But...
Read more >Installing Cython — Cython 3.0.0a11 documentation
On Ubuntu or Debian, for instance, it is part of the build-essential package. Next to a C compiler, Cython requires the Python header...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
When I encountered this error with a docker install I did
pip3 install pandas==1.0.5
and it workedYou’re right that Cython isn’t required for install, only dev.
That check is guarded in a try block after a Cython import - possible you had an old or otherwise incomplete install? Standard python installations shouldn’t ship with Cython https://github.com/pandas-dev/pandas/blob/0409521665bd436a10aea7e06336066bf07ff057/setup.py#L38