I have been trying to find a solution to this import error regarding the pandas library when it says no module named "parsing." Every library should be installed correctly from the interpreter and they are all the latest version.
This is what the console returns:
Traceback (most recent call last):
File "C:\Users\shaya\PycharmProjects\NEA\venv\lib\site-packages\pandas\__init__.py", line 26, in <module>
from pandas._libs import (hashtable as _hashtable,
File "C:\Users\shaya\PycharmProjects\NEA\venv\lib\site-packages\pandas\_libs\__init__.py", line 4, in <module>
from .tslib import iNaT, NaT, Timestamp, Timedelta, OutOfBoundsDatetime
File "pandas\_libs\tslibs\conversion.pxd", line 11, in init pandas._libs.tslib
File "pandas\_libs\tslibs\conversion.pyx", line 40, in init pandas._libs.tslibs.conversion
ModuleNotFoundError: No module named 'parsing'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:/Users/shaya/PycharmProjects/NEA/Main.py", line 4, in <module>
import pandas_datareader.data as data
File "C:\Users\shaya\PycharmProjects\NEA\venv\lib\site-packages\pandas_datareader\__init__.py", line 2, in <module>
from .data import (DataReader, Options, get_components_yahoo,
File "C:\Users\shaya\PycharmProjects\NEA\venv\lib\site-packages\pandas_datareader\data.py", line 7, in <module>
from pandas_datareader.av.forex import AVForexReader
File "C:\Users\shaya\PycharmProjects\NEA\venv\lib\site-packages\pandas_datareader\av\__init__.py", line 3, in <module>
from pandas_datareader.base import _BaseReader
File "C:\Users\shaya\PycharmProjects\NEA\venv\lib\site-packages\pandas_datareader\base.py", line 7, in <module>
import pandas.compat as compat
File "C:\Users\shaya\PycharmProjects\NEA\venv\lib\site-packages\pandas\__init__.py", line 35, in <module>
"the C extensions first.".format(module))
ImportError: C extension: No module named 'parsing' 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.
All of the above tracebacks are from PyCharm.
OS: Windows.
I am using pip to install packages
Python version: 3.7.1, panda version: 0.23.4
Do you have python added to path? To test this; open a cmd and type python. If it is on your path, you should see the version of python you are running (Assuming you are using a windows machine). If this is the case, you can simply run the command after you checked this. If not, please navigate to the location where Python is installed, open python.exe and try to run the command python setup.py build_ext --inplace --force
If this doesn't work, you should try to re-install pandas by pip install --upgrade --force-reinstall pandas
If this also fails you could also go rigourous, and simply create a new environment and install pandas there. Sidenote: It is probably better to install pandas by using conda package manager, Pandas has portions of its code written in C to make it run faster. If you tried to install pandas manually you would need to build it.
I had the same problem under the same circumstances. I went through the code of some of the pandas files and saw that there is indeed a module named 'parsing' in the tslib folder of my pandas directory, yet for some reason it's not able to call it. I just reinstalled python and now it's working for me. If you find any other alternative, please let me know.
Related
I have python 3.10 installed on disk C: and Anaconda with Python 3.9 on disk D:. When I try importing numpy in jupyter, I get the following error.
>>> import numpy
Traceback (most recent call last):
File "C:\Python310\Lib\site-packages\numpy\core\__init__.py", line 23, in <module>
from . import multiarray
File "C:\Python310\Lib\site-packages\numpy\core\multiarray.py", line 10, in <module>
from . import overrides
File "C:\Python310\Lib\site-packages\numpy\core\overrides.py", line 6, in <module>
from numpy.core._multiarray_umath import (
ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python310\Lib\site-packages\numpy\__init__.py", line 140, in <module>
from . import core
File "C:\Python310\Lib\site-packages\numpy\core\__init__.py", line 49, 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.9 from "D:\ProgramData\Anaconda3\python.exe"
* The NumPy version is: "1.23.3"
and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.
Original error was: No module named 'numpy.core._multiarray_umath'
Looks like Python interpreter from disk D: is looking for libraries in disk C:, and I suppose that the numpy file installed there is not compatible with python 3.9. I think it's because my PYTHONPATH is
>>> print("PYTHONPATH:", os.environ.get('PYTHONPATH'))
PYTHONPATH: C:\Python310\Lib\site-packages
But how do I change it so that Jupyter only looks for what's in Anaconda folder libraries and not break whatever I have on disk C:? I guess what I'm asking is, is it possible to have 2 PYTHONPATHs, one for Jupyter and one for whatever else? Would it be sufficient to just add Anaconda libraries folder to PYTHONPATH, or it would cause conflicts? Because how would Jupyter choose one path over the other?
I was reading This, when it said I was supposed to use the command python -m ursina.build to compile my project. When I launched the .bat file I got this error
package_folder: C:\Users\sbahr\OneDrive\Documents\programming\Python\MeshGame\build\python\lib\site-packages\ursina
asset_folder: src
screen resolution: (1920, 1080)
Traceback (most recent call last):
File "C:\Users\sbahr\OneDrive\Documents\programming\Python\MeshGame\main.py", line 3, in <module>
from mesh import ChunkManager
File "C:\Users\sbahr\OneDrive\Documents\programming\Python\MeshGame\mesh.py", line 19, in <module>
from noise import generateSaveNoise
File "C:\Users\sbahr\OneDrive\Documents\programming\Python\MeshGame\noise.py", line 3, in <module>
import numpy as np
ModuleNotFoundError: No module named 'numpy'
I ran pip install numpy and it said numpy was already installed.
This used to be automatic, but broke in a newer version of Python. Therefore you'll have to provide a list of extra modules to copy, if you're using any.
From ursina's documentation (https://www.ursinaengine.org/building.html):
Make sure to include any extra modules with --include_modules PIL,numpy for example.
I try to install dash on a mac OS, and I have the following error when running 'import dash' on a python script:
Traceback (most recent call last):
File "app.py", line 16, in <module>
import dash
File "/Users/manuel/Library/Python/3.9/lib/python/site-packages/dash/__init__.py", line 5, in <module>
from .dash import Dash, no_update # noqa: F401,E402
File "/Users/manuel/Library/Python/3.9/lib/python/site-packages/dash/dash.py", line 17, in <module>
from flask_compress import Compress
File "/Users/manuel/Library/Python/3.9/lib/python/site-packages/flask_compress/__init__.py", line 1, in <module>
from .flask_compress import Compress
File "/Users/manuel/Library/Python/3.9/lib/python/site-packages/flask_compress/flask_compress.py", line 14, in <module>
import brotli
File "/Users/manuel/Library/Python/3.9/lib/python/site-packages/brotli.py", line 8, in <module>
import _brotli
ModuleNotFoundError: No module named '_brotli'
I can't figure it out what is the problem. I use python 3.7. I saw on the internet a similar issue on windows, but not on mac. I would be really grateful if you could help me.
You seem to have a broken installation of the brotli module (missing its native code component _brotli).
Try uninstalling it with pip uninstall brotli, then reinstall it; pip install brotli.
Going forward, I would heavily recommend you learn and use virtualenvs instead of installing everything into your Python's site-packages.
After uninstalling and installing again brotli it worked! Moreover, working in virtual environments is really more appropriate. Thank you a lot, AKX.
I have a question about using numpy library.
A couple of months ago, I downloaded Anaconda, which gives numpy automatically.
I am trying to use numpy by importing from ANaconda to Python.
WHat I have done is:
I added the package of numpy from Anaconda folder to Python folder.
However, the python shell says that
File "C:\Users\Alice Jun\Desktop\Python 3.9\numpy\core\__init__.py", line 22, in <module>
from . import multiarray
File "C:\Users\Alice Jun\Desktop\Python 3.9\numpy\core\multiarray.py", line 12, in <module>
from . import overrides
File "C:\Users\Alice Jun\Desktop\Python 3.9\numpy\core\overrides.py", line 7, in <module>
from numpy.core._multiarray_umath import (
ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Alice Jun\Desktop\Python 3.9\gui.py", line 2, in <module>
import numpy as np
File "C:\Users\Alice Jun\Desktop\Python 3.9\numpy\__init__.py", line 140, in <module>
from . import core
File "C:\Users\Alice Jun\Desktop\Python 3.9\numpy\core\__init__.py", line 48, in <module>
raise ImportError(msg)
What should I do to import numpy?
Thank you and stay safe!
As others mentioned, that is not a proper way of installing a package. You are making a copy anyway, so install it through proper routes, e.g.,
# where `python` is the one you wish to use
python -m pip install numpy
Otherwise, the reason why what OP shows did not work is because packages are located under a site-packages directory (search under your Python 3.9/ directory. If one really wants to manually install a package, that's where it goes.
However, be aware that Conda packages make heavy use of dynamic linking in order to minimize redundancy of common dependencies. This is often done through #rpath specifications, which means moving packages out of their Conda environment path will frequently result in non-functionality.
I usually code in Matlab but I found a nice piece of PYTHON code that I would like to use. However having downloaded the package it is proving difficult to run. I'm getting the following error:
Traceback (most recent call last):
File "C:\launch.py", line 29, in <module>
from src.smcsquare import SMCsquare
File "C:\src\smcsquare.py", line 32, in <module>
from scipy.stats import norm
File "C:\Python34\lib\site-packages\scipy\stats\__init__.py", line 338, in <module>
from .stats import *
File "C:\Python34\lib\site-packages\scipy\stats\stats.py", line 184, in <module>
import scipy.special as special
File "C:\Python34\lib\site-packages\scipy\special\__init__.py", line 586, in <module>
from ._ufuncs import *
ImportError: DLL load failed: The specified module could not be found.
The _ufuncs.pyd is there in the C:\Python34\lib\site-packages\scipy\special\ directory. I tried adding this to my PYTHONPATH but it made no difference. I have also tried so dll fixers but these have not helped.
Has anyone encountered this and did you find a solution?
As other have said, make sure your .whl file matches the version and 32/64bit of the python distribution you're using.
Next, the problem I was having was I forgot to download and install the extra "numpy+mkl" package per the instruction: http://www.lfd.uci.edu/~gohlke/pythonlibs/#scipy
So for me it was numpy-1.11.0+mkl-cp35-cp35m-win_amd64.whl, which I downloaded and then:
python -m pip install numpy-1.11.0+mkl-cp35-cp35m-win_amd64.whl
I had already installed the regular numpy package via pip, but I just installed this one over it and everything started working and has been fine so far.