Closed joooeey closed 4 years ago
Are you getting any output from python setup.py build_ext --inplace -j 4
?
Yes I did get lots of output but that went out of my Anaconda Prompt buffer:
Here's the last lines in the buffer that I got from setup.py build_ext --inplace --force
:
However, I still get an error when I import pandas in Spyder
Do you get the same error when, from the anaconda prompt (with pandas-dev
activated), you type
python
and then, in the Python REPL,
import pandas
?
@MarcoGorelli I get a similar error when running Python directly in Anaconda Prompt:
(pandas-dev) c:\Users\Joey\pandas-joooeey>doskey /history
cd c:\\users\joey\pandas-joooeey
conda update conda
conda env create -f environment.yml
conda activate pandas-dev
python setup.py build_ext --inplace -j 4
python -m pip install -e . --no-build-isolation --no-use-pep517
python setup.py build_ext --inplace --force
cython --version
doskey /history
(pandas-dev) c:\Users\Joey\pandas-joooeey>python
Python 3.8.2 | packaged by conda-forge | (default, Apr 24 2020, 07:34:03) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "c:\Users\Joey\pandas-joooeey\pandas\__init__.py", line 52, in <module>
from pandas.core.api import (
File "c:\Users\Joey\pandas-joooeey\pandas\core\api.py", line 15, in <module>
from pandas.core.arrays import Categorical
File "c:\Users\Joey\pandas-joooeey\pandas\core\arrays\__init__.py", line 8, in <module>
from pandas.core.arrays.datetimes import DatetimeArray
File "c:\Users\Joey\pandas-joooeey\pandas\core\arrays\datetimes.py", line 46, in <module>
from pandas.core.arrays import datetimelike as dtl
File "c:\Users\Joey\pandas-joooeey\pandas\core\arrays\datetimelike.py", line 11, in <module>
from pandas._libs.tslibs.timestamps import (
ImportError: cannot import name 'integer_op_not_supported' from 'pandas._libs.tslibs.timestamps' (c:\Users\Joey\pandas-joooeey\pandas\_libs\tslibs\timestamps.cp38-win_amd64.pyd)
>>>
@joooeey in your last output, can you run python
from a different directory? (not from within the pandas repo)
@joooeey in your last output, can you run
python
from a different directory? (not from within the pandas repo)
Running from c:\
, I get the same traceback.
import pandas Traceback (most recent call last): File "C:\Users\Joey\pandas-joooeey\pandas\__init__.py", line 32, in <module> from pandas._libs import hashtable as _hashtable, lib as _lib, tslib as _tslib File "C:\Users\Joey\pandas-joooeey\pandas\_libs\__init__.py", line 13, in <module> from pandas._libs.interval import Interval ModuleNotFoundError: No module named 'pandas._libs.interval' The above exception was the direct cause of the following exception: Traceback (most recent call last): File "<ipython-input-1-38d4b0363d82>", line 1, in <module> import pandas File "C:\Users\Joey\pandas-joooeey\pandas\__init__.py", line 40, in <module> ) from e ImportError: C extension: No module named 'pandas._libs.interval' not built. If you want to import pandas from the source directory, you may need to run 'python setup.py build_ext --inplace --force' to build the C extensions first.
I just noticed that of the two Tracebacks given in the problem description (and copied straight above), the lower one has illogical grammar. So the suggestion to rebuild the C extensions in the exception text may be intended for a different ImportError
. In any case, rebuilding the C extensions doesn't help.
For context the relevant snippet from pandas\__init__.py
which shows how that illogical error message is cobbled together:
try:
from pandas._libs import hashtable as _hashtable, lib as _lib, tslib as _tslib
except ImportError as e: # pragma: no cover
# hack but overkill to use re
module = str(e).replace("cannot import name ", "")
raise ImportError(
f"C extension: {module} not built. If you want to import "
"pandas from the source directory, you may need to run "
"'python setup.py build_ext --inplace --force' to build the C extensions first."
) from e
The upper of the two Tracebacks (the original exception) just points to a missing module pandas._libs.interval
. How can this be? I have both the files pandas\_libs\interval.c
and pandas\_libs\interval.pyx
.
I just tried running python setup.py build_ext --inplace --force
which resulted in an error:
python setup.py build_ext --inplace -j 4
(run right after) gives more verbose output with the same error:
I solved this by updating the Visual Studio Build Tools 2019 from 15.4.0 to 16.6.0 and running:
python setup.py build_ext --inplace --force
I solved this by updating the Visual Studio Build Tools 2019 from 15.4.0 to 16.6.0 and running:
python setup.py build_ext --inplace --force
Upgrading the Build Tools to VS 2019 resolves all the issues.
I'm on Ubuntu and installed via conda
I didn't have to update any build tools
Running python setup.py build_ext --inplace --force
alone fixed it for me
[x] I have checked that this issue has not already been reported.
[x] I have confirmed this bug exists on the latest version of pandas.
[ ] (optional) I have confirmed this bug exists on the master branch of pandas.
Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.
Code Sample, a copy-pastable example
pulled out from #33821 (the main symptom was that
import pandas
failed (see problem description):I just re-built the pandas-dev environment altogether:
I ran:
conda env remove --name pandas-dev
The
pandas-joooeey
folder was still there so I deleted it.Then I ran in Git Bash:
And then the following commands in Anaconda Prompt (as given by
doskey /history
:None of these threw errors. However, I still get an error when I
import pandas
in Spyder (I made sure to open a fresh console in Spyder):I also tried re-basing master from upstream in Git Bash:
Console output:
After that,
import pandas
still results in the same C extension error as given above.The only thing I left untouched was the Visual Studio Build Tools 2019.
I have the following build tools installed/missing:
Installation details MSBuild Tools Provides the tools required to build MSBuild-based applications.
C++ build tools
Included
[x] C++ Build Tools core features
[x] C++ 2019 Redistributable Update
Optional
[x] MSVC v142 - VS 2019 C++ x64/x86 build tools (v14.25)
[x] Windows 10 SDK (10.0.18362.0)
[x] C++ CMake tools for Windows
[x] Testing tools core features - Build Tools
[x] C++ AddressSanitizer (Experimental)
[ ] C++ ATL for latest v142 build tools (x86 & x64)
[ ] C++ MFC for latest v142 build tools (x86 & x64)
[ ] C++/CLI support for v142 build tools (14.25)
[ ] C++ Modules for v142 build tools (x64/x86 – experimental)
[ ] C++ Clang tools for Windows (9.0.0 - x64/x86)
[ ] Windows 10 SDK (10.0.17763.0)
[ ] Windows 10 SDK (10.0.17134.0)
[ ] Windows 10 SDK (10.0.16299.0)
[ ] MSVC v141 - VS 2017 C++ x64/x86 build tools (v14.16)
[ ] MSVC v140 - VS 2015 C++ build tools (v14.00)
Problem description
import pandas
fails on mymaster
branch:Output of
pd.show_versions()
N/A -- cannot even import Pandas.
The fork from pandas-dev was made in April 2020.