I installed anaconda3 and python 3.9
Looks like anaconda3 is running with python 3.8.
When i installed first my jupyter on anaconda3 was working, but i did some changes in path/pythonpath and after that i am getting error on jupyter but it works fine on visual studio.
So far i have tried
Installing and uninstalling anaconda3 and python 3.9
Installing and uninstalling pandas and numpy
Below is output from jupyter for path and python path
import os
print("PYTHONPATH:", os.environ.get('PYTHONPATH'))
print("PATH:", os.environ.get('PATH'))
*******************************************************************
PYTHONPATH: C:\Users\sachi\anaconda3\python.exe
PATH: C:\Users\sachi\anaconda3;C:\Users\sachi\anaconda3\Library\mingw-w64\bin;C:\Users\sachi\anaconda3\Library\usr\bin;C:\Users\sachi\anaconda3\Library\bin;C:\Users\sachi\anaconda3\Scripts;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;c:\users\sachi\appdata\local\programs\python\python39\lib\site-packages;C:\Python38\python.exe;C:\Users\sachi\AppData\Local\Programs\Python\Python39\Scripts\;C:\Users\sachi\AppData\Local\Programs\Python\Python39\;C:\Users\sachi\AppData\Local\Microsoft\WindowsApps;C:\Users\sachi\AppData\Local\Programs\Microsoft VS Code\bin;c:\Python39;
*******************************************************************
Below is the error I get when I import pandas as pd in jupyter
ImportError Traceback (most recent call last)
<ipython-input-4-7dd3504c366f> in <module>
----> 1 import pandas as pd
~\pandas\__init__.py in <module>
14
15 if missing_dependencies:
---> 16 raise ImportError(
17 "Unable to import required dependencies:\n" + "\n".join(missing_dependencies)
18 )
ImportError: Unable to import required dependencies:
numpy:
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.8 from "C:\Users\sachi\anaconda3\python.exe"
* The NumPy version is: "1.20.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'
You can enter pip uninstall pandas first, Then enter pip uninstall numpy. These two step is to uninstall two modular. Ater that,you can enter pip install pandas and pip install numpy to reload two modular. That's how I solved the problem I just met
Related
Getting error with VS Code in installing pkg Numpy and Pandas. Any solution on how we can fix the issue? Thanks.
Error:
from . import _distributor_init
Traceback (most recent call last):
File ".\Form_validate.py", line 1, in <module>
import pandas as pd
File "C:\ProgramData\Anaconda3\lib\site-packages\pandas\__init__.py", line 17, in <module>
"Unable to import required dependencies:\n" + "\n".join(missing_dependencies)
ImportError: Unable to import required dependencies:
numpy:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy c-extensions failed.
- Try uninstalling and reinstalling numpy.
- If you have already done that, then:
1. Check that you expected to use Python3.7 from "C:\ProgramData\Anaconda3\python.exe",
and that you have no directories in your PATH or PYTHONPATH that can
interfere with the Python and numpy version "1.18.1" you're trying to use.
2. If (1) looks fine, you can open a new issue at
https://github.com/numpy/numpy/issues. Please include details on:
- how you installed Python
- how you installed numpy
- your operating system
- whether or not you have multiple versions of Python installed
- if you built from source, your compiler versions and ideally a build log
- If you're working with a numpy git repository, try `git clean -xdf`
(removes all files not under version control) and rebuild numpy.
Note: this error has many possible causes, so please don't comment on
an existing issue about this - open a new one instead.
Original error was: DLL load failed: The specified module could not be found.
There are two solutions.
The first is to reinstall numpy, including its architecture tools. Reinstall the package by using the following code in sequence:
pip uninstall -y numpy
pip uninstall -y setuptools
pip install setuptools
pip install numpy
The second solution is to add the path to the environment variable. In fact, pylance did not find this file because
File "C:\ProgramData\Anaconda3\lib\site-packages\pandas_init_.py", line 17,
If you try to make Python output sys.path, you will find that it is anaconda3 instead of Anaconda3.
So, adding the path to environment variable can solve it.
This happens because if VS Code is launched apart, as usual, it will recognize Python from Anaconda setup but will have trouble loading imports.
Fix: Close VS Code. Then open anaconda shell, i.e., the terminal, and from there launch VS code with the comand:
Anaconda_prompt> code
You'll see terminal inside VS Code will run automatically the command:
conda activate base
Then run your program again within VS Code, and should work fine as expected.
My Flask Application was working alright and all of a sudden I am seeing this error when I run the command to launch the App locally.
File "/Flask_Trial_App2/index.py", line 6, in <module>
import pandas as pd
File "/Flask_Trial_App/virt/lib/python3.8/site-packages/pandas/__init__.py", line 16, in <module>
raise ImportError(
ImportError: Unable to import required dependencies:
numpy:
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.8 from "/Flask_Trial_App/virt/bin/python"
* The NumPy version is: "1.21.1"
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'
I tried upgrading pandas and numpy, but it didn't fix the issue.
pip install --upgrade numpy
pip install --upgrade pandas
I've had similar issues to this when deploying flask apps on servers with different environments, here is something I've done that worked in the past in case this helps:
Uninstall the package then reinstall specific version using the absolute path to the python executable.
/Flask_Trial_App/virt/bin/python3 -m pip uninstall numpy; /Flask_Trial_App/virt/bin/python3 -m pip install numpy==1.21.1
Hope that may help.
I am trying to run a python script off the Windows command prompt. The script runs in a server environment which is a tough place to install modules because of our companies firewalls. So It was convenient to use Anaconda 3 which includes python 3.8 and Data engineering modules like Pandas.
The script runs with no issue in Spyder and Visual Studio code, but when I try to run it in the Windows Command line I get the following error:
MKL initialization ensuring its correct out-of-the box operation under condition when Gnu OpenMP had already been loaded by Python process is not assured. Please install mkl-service package, see http://github.com/IntelPython/mkl-service
from . import _distributor_init
Traceback (most recent call last):
File "installservice.py", line 9, in <module>
import pandas as pd
File "C:\ProgramData\Anaconda3\lib\site-packages\pandas\__init__.py", line 16, in <module>
raise ImportError(
ImportError: Unable to import required dependencies:
numpy:
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.8 from "C:\ProgramData\Anaconda3\python.exe"
* The NumPy version is: "1.19.2"
Again the script runs with no issues in my IDEs but not on Windows Command Line. Please help
Try upgrading the pip and then try to uninstall if they are already present in the below order.
pip uninstall pandas
pip uninstall numpy
pip install pandas
pip install numpy
I am not able to import pandas
C:\Users\Yash\Desktop\Python\Twitter Sentimental Analysis>python import.py
Traceback (most recent call last):
File "C:\Users\Yash\AppData\Local\Programs\Python\Python36\lib\site-packages\pandas\__init__.py", line 26, in <module>
from pandas._libs import (hashtable as _hashtable,
File "C:\Users\Yash\AppData\Local\Programs\Python\Python36\lib\site-packages\pandas\_libs\__init__.py", line 4, in <module>
from .tslib import iNaT, NaT, Timestamp, Timedelta, OutOfBoundsDatetime
ModuleNotFoundError: No module named 'pandas._libs.tslib'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "import.py", line 4, in <module>
import pandas as pd
File "C:\Users\Yash\AppData\Local\Programs\Python\Python36\lib\site-packages\pandas\__init__.py", line 35, in <module>
"the C extensions first.".format(module))
ImportError: C extension: No module named 'pandas._libs.tslib' 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 tried screwing around but this error stayed the same.
I have updated the modules already along with pip and python!
This is the full traceback of the command.
I am currently using python 3.6.6 (downloaded from the official site)
pip version : 18.1 running on windows 10 laptop!!
I faced a similar issue and solved it by manually uninstalling pandas and then installing pandas using pip. You have mentioned that you have only updated pandas. So I assume you haven't tried re-installing it.
While doing so pandas version in my environment changed from 0.23.4 to 0.24.1
My Environment :
python 3.6.7
pip 18.1
Note : I am also a beginner in Python usage. More experienced users may know a better way.
pip uninstall pandas
pip install pandas
The above steps solved my issues and I am able to import pandas.
I checked the release notes in pandas community and it seems like the dependency on tslib has been removed.
Check section 1.5 in the below link and search for tslib.
http://pandas.pydata.org/pandas-docs/version/0.24/pandas.pdf
I faced the same error and resolved it by calling the following commands:
pip uninstall pandas
pip install pandas
pip3 install --upgrade pandas
I was facing the same error. I tried the above solutions didn't work out. Here what worked for me.
If you have two different python env and trying to run files from different env then first you have to uninstall pandas from both env and install them in the new env.
For example, I have installed python3.6 and python3.9, so first I uninstalled pandas from 3.6
sudo pip3.6 uninstall pandas
I repeated this command serval times until all versions of pandas have uninstalled. after that, I install the pandas in 3.9 using this command
/usr/bin/python3.9 -m pip install pandas
I'm having trouble loading a package that is installed in my environment and have no idea why..
conda list
fbprophet 0.3.post2 py36_0 conda-forge
When I request for libraries installed in conda, it clearly shows that I have fbprophet installed. Now, when I import it, a ModuleNotFoundError exception is thrown.
from fbprophet import Prophet
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-1-83be6864a7aa> in <module>()
----> 1 from fbprophet import Prophet
2 import numpy as np
3 import pandas as pd
ModuleNotFoundError: No module named 'fbprophet'
Has anybody run into this issue? What can I do to troubleshoot this?
My suggestion would be creating a virtual environment for your python first, then conda install your package in the virtual environment.
My script was reading from my pip install list where the module fbprophet did not exist. I went back and installed it there and everything worked. Lesson learned.
Always check where your libraries are being read from.
You may have more than one Python installation. Thus you might installed the library in one Python installation and tried to call it from another one. Please let me know if you have more than one Python installation by printing the result os this CMD command where python.