-
-
Notifications
You must be signed in to change notification settings - Fork 18.3k
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
BUG: Dependency check custom error loses information #61030
Comments
Thanks for the report! Can you paste the full error that was useful in debugging here. The current method was implemented due to #12176. I don't think we should just remove it. Perhaps we could say "Run |
I have pasted the full error behind a details tag, I'll edit the post to make it more visible. |
Hi @Noratrieb , I tried to reproduce your error message on the main branch using Docker (built from this Dockerfile). I deleted the shared object file Could you provide more details on how to reproduce your error message? Thanks! >>> import pandas as pd
+ /usr/local/bin/ninja
[1/1] Generating write_version_file with a custom command
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/pandas/pandas/__init__.py", line 47, in <module>
from pandas.core.api import (
File "/home/pandas/pandas/core/api.py", line 46, in <module>
from pandas.core.groupby import (
File "/home/pandas/pandas/core/groupby/__init__.py", line 1, in <module>
from pandas.core.groupby.generic import (
File "/home/pandas/pandas/core/groupby/generic.py", line 66, in <module>
from pandas.core.frame import DataFrame
File "/home/pandas/pandas/core/frame.py", line 144, in <module>
from pandas.core.generic import (
File "/home/pandas/pandas/core/generic.py", line 173, in <module>
from pandas.core.window import (
File "/home/pandas/pandas/core/window/__init__.py", line 1, in <module>
from pandas.core.window.ewm import (
File "/home/pandas/pandas/core/window/ewm.py", line 11, in <module>
import pandas._libs.window.aggregations as window_aggregations
ImportError: libstdc++.so.6: cannot open shared object file: No such file or directory |
I was on a NixOS system where libstdc++ was not in the search path. It looks like something tried to execute ninja in your reproduction, it might help your reproduction to remove ninja as well (I didn't have ninja available either). |
No, that's not actually relevant, I tried the dockerfile myself. It's interesting that with the dockerfile, the error seems to happen on line 47 of it looks like |
Okay, I got a way to reproduce it. The libstdc++ case confuses me a bit, but if I remove libz ( |
Thanks @Noratrieb ! I also got same error message. >>> import pandas as pd
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/pandas/pandas/__init__.py", line 16, in <module>
raise ImportError(
ImportError: Unable to import required dependencies:
numpy: Error importing numpy: you should not try to import numpy from
its source directory; please exit the numpy source tree, and relaunch
your python interpreter from there. |
If we try >>> import pandas as pd
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/pandas/pandas/__init__.py", line 16, in <module>
raise ImportError(
ImportError: Unable to import required dependencies:
numpy: Error importing numpy: you should not try to import numpy from
its source directory; please exit the numpy source tree, and relaunch
your python interpreter from there.
>>> import numpy as np
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/numpy/core/__init__.py", line 24, in <module>
from . import multiarray
File "/usr/local/lib/python3.10/site-packages/numpy/core/multiarray.py", line 10, in <module>
from . import overrides
File "/usr/local/lib/python3.10/site-packages/numpy/core/overrides.py", line 8, in <module>
from numpy.core._multiarray_umath import (
ImportError: libz.so.1: cannot open shared object file: No such file or directory
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/numpy/__init__.py", line 130, in <module>
from numpy.__config__ import show as show_config
File "/usr/local/lib/python3.10/site-packages/numpy/__config__.py", line 4, in <module>
from numpy.core._multiarray_umath import (
File "/usr/local/lib/python3.10/site-packages/numpy/core/__init__.py", line 50, in <module>
raise ImportError(msg)
ImportError:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.
We have compiled some common reasons and troubleshooting tips at:
https://numpy.org/devdocs/user/troubleshooting-importerror.html
Please note and check the following:
* The Python version is: Python3.10 from "/usr/local/bin/python3"
* The NumPy version is: "1.26.4"
and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.
Original error was: libz.so.1: cannot open shared object file: No such file or directory
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.10/site-packages/numpy/__init__.py", line 135, in <module>
raise ImportError(msg) from e
ImportError: Error importing numpy: you should not try to import numpy from
its source directory; please exit the numpy source tree, and relaunch
your python interpreter from there. |
take |
Pandas version checks
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
Issue Description
I was importing pandas in an environment where
libstdc++.so.6
could not be found, which causes numpy to fail to load its C++ extensions.The error I got was the following:
This does not contain any information about the missing shared library. If I patch out this custom throw
pandas/pandas/__init__.py
Line 13 in 57fd502
raise _e
I get the full error, which mentioned missinglibstdc++.so.6
which was very useful to debug the issue (hidden in a details tag as it's big):The full error
Expected Behavior
Pandas printing the full error, including nested exceptions.
Installed Versions
It can't run it because my environment is broken, but I can see the relevant code on master. Pandas version is 2.2.3
The text was updated successfully, but these errors were encountered: