Skip to content

Release 0.25.0rc0 cannot import DataFrame on Python 3.5.2 #27247

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
davidnewman02 opened this issue Jul 5, 2019 · 13 comments
Closed

Release 0.25.0rc0 cannot import DataFrame on Python 3.5.2 #27247

davidnewman02 opened this issue Jul 5, 2019 · 13 comments
Labels
Compat pandas objects compatability with Numpy or Python functions
Milestone

Comments

@davidnewman02
Copy link

davidnewman02 commented Jul 5, 2019

Code Sample, a copy-pastable example if possible

Picked up version 0.25.0rc0 last night:
https://files.pythonhosted.org/packages/19/b6/124914598447928889c6fe08a3e40ff791e1c66c7f6e3234374eefe38359/pandas-0.25.0rc0-cp35-cp35m-win_amd64.whl#sha256=ef9976c835d4a3f1de54b0d176711d27952b48cdf752b37fe60e69395fe35b9b

>>>from pandas import DataFrame
...
 TypeError: descriptor '__subclasses__' of 'type' object needs an argument

Full traceback:

File "c:\my_project\test_runner.py", line 6, in <module>
    from pandas import DataFrame
  File "c:\my_project\venv\lib\site-packages\pandas-0.25.0rc0-py3.5-win-amd64.egg\pandas\__init__.py", line 55, in <module>
    from pandas.core.api import (
  File "c:\my_project\venv\lib\site-packages\pandas-0.25.0rc0-py3.5-win-amd64.egg\pandas\core\api.py", line 5, in <module>
    from pandas.core.arrays.integer import (
  File "c:\my_project\venv\lib\site-packages\pandas-0.25.0rc0-py3.5-win-amd64.egg\pandas\core\arrays\__init__.py", line 1, in <module>
    from .array_ import array  # noqa: F401
  File "c:\my_project\venv\lib\site-packages\pandas-0.25.0rc0-py3.5-win-amd64.egg\pandas\core\arrays\array_.py", line 7, in <module>
    from pandas.core.dtypes.common import (
  File "c:\my_project\venv\lib\site-packages\pandas-0.25.0rc0-py3.5-win-amd64.egg\pandas\core\dtypes\common.py", line 11, in <module>
    from pandas.core.dtypes.dtypes import (
  File "c:\my_project\venv\lib\site-packages\pandas-0.25.0rc0-py3.5-win-amd64.egg\pandas\core\dtypes\dtypes.py", line 53, in <module>
    class Registry:
  File "c:\my_project\venv\lib\site-packages\pandas-0.25.0rc0-py3.5-win-amd64.egg\pandas\core\dtypes\dtypes.py", line 84, in Registry
    self, dtype: Union[Type[ExtensionDtype], str]
  File "C:\Users\my_user\AppData\Local\Programs\Python\Python35\Lib\typing.py", line 552, in __getitem__
    dict(self.__dict__), parameters, _root=True)
  File "C:\Users\my_user\AppData\Local\Programs\Python\Python35\Lib\typing.py", line 512, in __new__
    for t2 in all_params - {t1} if not isinstance(t2, TypeVar)):
  File "C:\Users\my_user\AppData\Local\Programs\Python\Python35\Lib\typing.py", line 512, in <genexpr>
    for t2 in all_params - {t1} if not isinstance(t2, TypeVar)):
  File "C:\Users\my_user\AppData\Local\Programs\Python\Python35\Lib\typing.py", line 1077, in __subclasscheck__
    if super().__subclasscheck__(cls):
  File "c:\my_project\venv\lib\abc.py", line 225, in __subclasscheck__
    for scls in cls.__subclasses__():
TypeError: descriptor '__subclasses__' of 'type' object needs an argument

Expected Output

No error
Currently works on pandas==0.24.2

Output of pd.show_versions()

https://files.pythonhosted.org/packages/19/b6/124914598447928889c6fe08a3e40ff791e1c66c7f6e3234374eefe38359/pandas-0.25.0rc0-cp35-cp35m-win_amd64.whl#sha256=ef9976c835d4a3f1de54b0d176711d27952b48cdf752b37fe60e69395fe35b9b

@jreback
Copy link
Contributor

jreback commented Jul 5, 2019

do you have at least python 3.5.3?

@davidnewman02
Copy link
Author

Ah - my bad; hadn't checked the minimum versions carefully, this machines is running 3.5.2.
Hadn't realised pip would pick up a package that was incompatible :(

I'll update the title and close.

@davidnewman02 davidnewman02 changed the title Release 0.25.0rc0 cannot import DataFrame on Windows Release 0.25.0rc0 cannot import DataFrame on Python 3.5.2 Jul 5, 2019
@jreback
Copy link
Contributor

jreback commented Jul 5, 2019

@pandas-dev/pandas-core we should raise a nicer error message on import in “pandas/init

@jreback jreback reopened this Jul 5, 2019
@jreback jreback added this to the 0.25.0 milestone Jul 5, 2019
@jreback jreback added the Compat pandas objects compatability with Numpy or Python functions label Jul 5, 2019
@TomAugspurger
Copy link
Contributor

TomAugspurger commented Jul 5, 2019 via email

@TomAugspurger
Copy link
Contributor

@davidnewman02 what version of pip are you using? As a test, I set python_requires=">=3.7.5", (which doesn't exist) and pip correctly raised an error when I tried to install.

@davidnewman02
Copy link
Author

davidnewman02 commented Jul 8, 2019

I've seen the error on two of my build nodes ubuntu16+pip19.1.1 and an ancient win10+pip9.0, but I always update pip install pip --upgrade before doing a build.

$ rm -rf venv
$ virtualenv --python=python3 venv

Already using interpreter /usr/bin/python3
Using base prefix '/usr'
New python executable in /builds/3r3kUKxw/0/my_user/my_project/venv/bin/python3
Also creating executable in /builds/3r3kUKxw/0/my_user/my_project/venv/bin/python
Installing setuptools, pkg_resources, pip, wheel...done.
$ source venv/bin/activate && \
    pip install pip --upgrade && \
    python3 setup.py develop

Requirement already up-to-date: pip in ./venv/lib/python3.5/site-packages (19.1.1)
running develop
running egg_info
creating my_project.egg-info
writing my_project.egg-info/PKG-INFO
writing requirements to my_project.egg-info/requires.txt
writing top-level names to my_project.egg-info/top_level.txt
writing dependency_links to my_project.egg-info/dependency_links.txt
writing entry points to my_project.egg-info/entry_points.txt
writing manifest file 'my_project.egg-info/SOURCES.txt'
reading manifest file 'my_project.egg-info/SOURCES.txt'
writing manifest file 'my_project.egg-info/SOURCES.txt'
running build_ext
Creating /builds/3r3kUKxw/0/my_user/my_project/venv/lib/python3.5/site-packages/my-project.egg-link (link to .)
Adding my-project 0.0.0 to easy-install.pth file
Installing sanity_check script to /builds/3r3kUKxw/0/my_user/my_project/venv/bin
Installing basic_report script to /builds/3r3kUKxw/0/my_user/my_project/venv/bin
Installing plot_loss script to /builds/3r3kUKxw/0/my_user/my_project/venv/bin

Installed /builds/3r3kUKxw/0/my_user/my_project
Processing dependencies for my=project==0.0.0

Searching for matplotlib==3.0.3
Reading https://artifactory.oxfordnanolabs.local/artifactory/api/pypi/local-Pypi/simple/other-project
Reading https://pypi.org/simple/matplotlib/
Downloading https://files.pythonhosted.org/packages/89/61/465fb3bfba684b0f53b5c4829c3c89e86e6fe9fdcdfda93e38f1788090f0/matplotlib-3.0.3-cp35-cp35m-manylinux1_x86_64.whl#sha256=63e498067d32d627111cd1162cae1621f1221f9d4c6a9745dd7233f29de581b6
Best match: matplotlib 3.0.3
Processing matplotlib-3.0.3-cp35-cp35m-manylinux1_x86_64.whl
Installing matplotlib-3.0.3-cp35-cp35m-manylinux1_x86_64.whl to /builds/3r3kUKxw/0/my_user/my_project/venv/lib/python3.5/site-packages
writing requirements to /builds/3r3kUKxw/0/my_user/my_project/venv/lib/python3.5/site-packages/matplotlib-3.0.3-py3.5-linux-x86_64.egg/EGG-INFO/requires.txt
Adding matplotlib 3.0.3 to easy-install.pth file

Installed /builds/3r3kUKxw/0/my_user/my_project/venv/lib/python3.5/site-packages/matplotlib-3.0.3-py3.5-linux-x86_64.egg

Searching for scipy==1.2.2
Reading https://pypi.org/simple/scipy/
Downloading https://files.pythonhosted.org/packages/ed/25/71eb3b2f7bc99d211a2d1df759a4a1b8c93ad7a68cedc6522a1f9e09dcb8/scipy-1.2.2-cp35-cp35m-manylinux1_x86_64.whl#sha256=9a21d64d002cb3a9239a55c0aa100b48d58b5e38382c0fdfcdfc68cf417d8142
Best match: scipy 1.2.2
Processing scipy-1.2.2-cp35-cp35m-manylinux1_x86_64.whl
Installing scipy-1.2.2-cp35-cp35m-manylinux1_x86_64.whl to /builds/3r3kUKxw/0/my_user/my_project/venv/lib/python3.5/site-packages
writing requirements to /builds/3r3kUKxw/0/my_user/my_project/venv/lib/python3.5/site-packages/scipy-1.2.2-py3.5-linux-x86_64.egg/EGG-INFO/requires.txt
Adding scipy 1.2.2 to easy-install.pth file

Installed /builds/3r3kUKxw/0/my_user/my_project/venv/lib/python3.5/site-packages/scipy-1.2.2-py3.5-linux-x86_64.egg

Searching for pandas>=0.13.1
Reading https://pypi.org/simple/pandas/
Downloading https://files.pythonhosted.org/packages/e0/c0/e9fcd80669c3908c96f779db94896095a661e5c2180c61467b6a1df5accf/pandas-0.25.0rc0-cp35-cp35m-manylinux1_x86_64.whl#sha256=f7cfc35eccd977833e158064448c87c058837df193d526894dac74aabadb07cd
Best match: pandas 0.25.0rc0
Processing pandas-0.25.0rc0-cp35-cp35m-manylinux1_x86_64.whl
Installing pandas-0.25.0rc0-cp35-cp35m-manylinux1_x86_64.whl to /builds/3r3kUKxw/0/my_user/my_project/venv/lib/python3.5/site-packages
writing requirements to /builds/3r3kUKxw/0/my_user/my_project/venv/lib/python3.5/site-packages/pandas-0.25.0rc0-py3.5-linux-x86_64.egg/EGG-INFO/requires.txt
Adding pandas 0.25.0rc0 to easy-install.pth file

Installed /builds/3r3kUKxw/0/my_user/my_project/venv/lib/python3.5/site-packages/pandas-0.25.0rc0-py3.5-linux-x86_64.egg

Searching for numpy>=1.14
...
...

$ python --version
Python 3.5.2

@TomAugspurger
Copy link
Contributor

Why are there references to matplotlib and SciPy? Why is the RC fetched, I didn’t see a —pre flag.

Can you simplify the example?

@jorisvandenbossche
Copy link
Member

Just tried, and with pip 18 on ubuntu and Python 3.5.2, it installs 0.24.2 if I do pip install pandas --pre

Apart from the "why did pip try to install this" question, I think it would still be good to see if we can provide a better error message.
Just a simple python version check in the __init__.py before importing something from pandas might be the easiest?

@davidnewman02
Copy link
Author

davidnewman02 commented Jul 8, 2019

I'm not sure why I'm getting that version if I'm honest, packaging isn't my forte, but I wouldn't expect it to pick up a pre-release version without me explicitly telling it to. Perhaps I've set up my pip incorrectly?

I made a simplified setup.py:

from setuptools import setup, find_packages

setup(name='my-project',
      install_requires=['pandas>=0.13.1'],
      packages=find_packages())
$ rm -rf venv; virtualenv --python=python3 venv

Already using interpreter /usr/bin/python3
Using base prefix '/usr'
New python executable in /my_project/venv/bin/python3
Also creating executable in /my_project/venv/bin/python
Installing setuptools, pkg_resources, pip, wheel...done.

$ source venv/bin/activate && \
    pip install pip --upgrade && \
    python3 setup.py develop

Requirement already up-to-date: pip in ./venv/lib/python3.5/site-packages (19.1.1)
running develop
running egg_info
writing my_project.egg-info/PKG-INFO
writing top-level names to my_project.egg-info/top_level.txt
writing dependency_links to my_project.egg-info/dependency_links.txt
writing requirements to my_project.egg-info/requires.txt
reading manifest file 'my_project.egg-info/SOURCES.txt'
writing manifest file 'my_project.egg-info/SOURCES.txt'
running build_ext
Creating /my_project/venv/lib/python3.5/site-packages/my-project.egg-link (link to .)
Adding my-project 0.0.0 to easy-install.pth file

Installed /my_project
Processing dependencies for my-project==0.0.0
Searching for pandas>=0.13.1
Reading https://pypi.org/simple/pandas/
Downloading https://files.pythonhosted.org/packages/e0/c0/e9fcd80669c3908c96f779db94896095a661e5c2180c61467b6a1df5accf/pandas-0.25.0rc0-cp35-cp35m-manylinux1_x86_64.whl#sha256=f7cfc35eccd977833e158064448c87c058$
Best match: pandas 0.25.0rc0
Processing pandas-0.25.0rc0-cp35-cp35m-manylinux1_x86_64.whl
Installing pandas-0.25.0rc0-cp35-cp35m-manylinux1_x86_64.whl to /my_project/venv/lib/python3.5/site-packages
writing requirements to /my_project/venv/lib/python3.5/site-packages/pandas-0.25.0rc0-py3.5-linux-x86_64.egg/EGG-INFO/requires.txt
Adding pandas 0.25.0rc0 to easy-install.pth file

Installed /my_project/venv/lib/python3.5/site-packages/pandas-0.25.0rc0-py3.5-linux-x86_64.egg
Searching for pytz>=2017.2
Reading https://pypi.org/simple/pytz/
Downloading https://files.pythonhosted.org/packages/3d/73/fe30c2daaaa0713420d0382b16fbb761409f532c56bdcc514bf7b6262bb6/pytz-2019.1-py2.py3-none-any.whl#sha256=303879e36b721603cc54604edcac9d20401bdbe31e1e4fdee5b$
Best match: pytz 2019.1
Processing pytz-2019.1-py2.py3-none-any.whl
Installing pytz-2019.1-py2.py3-none-any.whl to /my_project/venv/lib/python3.5/site-packages
Adding pytz 2019.1 to easy-install.pth file

Installed /my_project/venv/lib/python3.5/site-packages/pytz-2019.1-py3.5.egg
Searching for python-dateutil>=2.6.1
Reading https://pypi.org/simple/python-dateutil/
Downloading https://files.pythonhosted.org/packages/41/17/c62faccbfbd163c7f57f3844689e3a78bae1f403648a6afb1d0866d87fbb/python_dateutil-2.8.0-py2.py3-none-any.whl#sha256=7e6584c74aeed623791615e26efd690f29817a27c$
Best match: python-dateutil 2.8.0
Processing python_dateutil-2.8.0-py2.py3-none-any.whl
Installing python_dateutil-2.8.0-py2.py3-none-any.whl to /my_project/venv/lib/python3.5/site-packages
writing requirements to /my_project/venv/lib/python3.5/site-packages/python_dateutil-2.8.0-py3.5.egg/EGG-INFO/requires.txt
Adding python-dateutil 2.8.0 to easy-install.pth file

Installed /my_project/venv/lib/python3.5/site-packages/python_dateutil-2.8.0-py3.5.egg
Searching for numpy>=1.13.3
Reading https://pypi.org/simple/numpy/
Downloading https://files.pythonhosted.org/packages/81/ad/38248e4eca29c80b057c6d43f25772461d87efbf2f798c323230ee5d9676/numpy-1.17.0rc1-cp35-cp35m-manylinux1_x86_64.whl#sha256=0e574d32e251510ed8ccd1f354f4f77ae38$
Best match: numpy 1.17.0rc1
Processing numpy-1.17.0rc1-cp35-cp35m-manylinux1_x86_64.whl
Installing numpy-1.17.0rc1-cp35-cp35m-manylinux1_x86_64.whl to /my_project/venv/lib/python3.5/site-packages
Adding numpy 1.17.0rc1 to easy-install.pth file
Installing f2py3 script to /my_project/venv/bin
Installing f2py3.5 script to /my_project/venv/bin
Installing f2py script to /my_project/venv/bin

Installed /my_project/venv/lib/python3.5/site-packages/numpy-1.17.0rc1-py3.5-linux-x86_64.egg
Searching for six>=1.5
Reading https://pypi.org/simple/six/
Downloading https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl#sha256=3350809f0555b11f552448330d0b52d5f24c91a322ea4a15ef22$
Best match: six 1.12.0
Processing six-1.12.0-py2.py3-none-any.whl
Installing six-1.12.0-py2.py3-none-any.whl to /my_project/venv/lib/python3.5/site-packages
Adding six 1.12.0 to easy-install.pth file

Installed /my_project/venv/lib/python3.5/site-packages/six-1.12.0-py3.5.egg
Finished processing dependencies for my-project==0.0.0
To activate your new environment:  source venv/bin/activate

@TomAugspurger
Copy link
Contributor

Run pip install -e . Rather than setup.py develop.

@TomAugspurger
Copy link
Contributor

I think that’s why the PyPA recommends avoiding executing setup.py directly, as pip doesn’t get called.

@davidnewman02
Copy link
Author

pip install -e /path/to/my_project works fine. I hadn't realised that PyPA recommended not doing setup.py develop, I use that all over the place; you learn something new everyday!

From a brief bit of reading: pip install -e uses pip to install packages from wheels, while setuptools appears to make use of the now deprecated easy-install and these may have different results. In this case, fatally different.

@jreback
Copy link
Contributor

jreback commented Jul 17, 2019

similar to #27288

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Compat pandas objects compatability with Numpy or Python functions
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants