I already have pip installed but I tried this code to install pandas in my Python27/Lib:
import os
os.system('pip install pandas')
and the tried samples here in :
Installing python module within code
and also tried the setup.py here in :https://github.com/pandas-dev/pandas
but this doesn't download pandas and numpy in my Python27/Lib any answers?
UPDATE:
I tried this: and currently installed pandas in my Python
try: import pandas
except ImportError:
from pip._internal import main as pip
pip(['install', '--user', 'pandas'])
import pandas
but I have this error:
[33mYou are using pip version 18.0, however version 18.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.[0m
Traceback (most recent call last):
File "C:\Users\Administrator\Desktop\OJT\scanner\install.py", line 5, in <module>
import pandas
ImportError: No module named pandas
Is there a way to install the updated version of pip?
You can look at the subprocess module in the standard library:
from subprocess import call
call(["pip", "install", "pandas"])
Related
I'm getting this error:
conftest.py:95: in <module>
from framework.scheduler import PytestScheduler
framework/scheduler.py:33: in <module>
from _pytest.mark import Expression, MarkMatcher
E ImportError: cannot import name 'Expression' from '_pytest.mark' (/usr/lib/python3/dist-packages/_pytest/mark/__init__.py)
could it possibly be my version of pytest? How do I know which version should I use?
The file /usr/lib/python3/dist-packages/_pytest/mark/__init__.py exists so it's installed.
sudo pip install --upgrade attrs==21.2.0
sudo pip install --upgrade pytest==6.2.4
fixed for me
I'm having troubles importing pandas:
import pandas
---
In [7]: import pandas
Traceback (most recent call last):
File "<ipython-input-7-d6ac987968b6>", line 1, in <module>
import pandas
File "//anaconda/lib/python3.6/site- packages/pandas/__init__.py", line 56, in <module>
import pandas.util.testing
File "//anaconda/lib/python3.6/site- packages/pandas/util/testing.py", line 22, in <module>
from numpy.testing.decorators import slow # noqa
ModuleNotFoundError: No module named 'numpy.testing.decorators'
I recently fully reinstalled anaconda with home-brew; moreover, I installed the following:
pip install numpy==1.18
pip install scipy==1.1.0
pip install scikit-learn==0.21.3
pip install pandas
The pandas version I'm using is 0.25.1
Does anyone have an idea of what might be going wrong?
Upgrade to pandas 1.0.0 (If you have no other reason not to) via,
pip install -U pandas
See if it helps.
pip uninstall numpy
pip install numpy==1.17.0
I have Python 3.7.3 installed and installed numpy, scipy via pip (cmd -> python -m pip install --user numpy scipy) and am able to import numpy, scipy if I use an admin command prompt to import both numpy and scipy. However, if I don't use an admin cmd prompt, or try to import scipy from the Python shell, I receive traceback errors like the following:
>>> import numpy
>>> import scipy
Traceback (most recent call last):
File "<pyshell#11>", line 1, in <module>
import scipy
ModuleNotFoundError: No module named 'scipy'
Does this traceback error come from not installing scipy in a certain way? Thanks for the help in advance.
When doing checking pip and python versions in cmd, here's my output:
pip --version
pip 19.1 from c:\program files\python37\lib\site-packages\pip (python 3.7)
python --version
Python 3.7.3
Add the location of your python scripts to the Path in Environment Variables.
C:\Users\User_Name\AppData\Roaming\Python\Python37\Scripts
You mentioned that you've already installed the packages. And the packages are stored in the site-packages file inside Python37 folder. So the error must be because you didn't add these to the path.
I'm using a python code using the package tqdm, I installed it with pip
androiddl#androiddl:~$ pip install tqdm Collecting tqdm Using cached
https://files.pythonhosted.org/packages/76/4c/103a4d3415dafc1ddfe6a6624333971756e2d3dd8c6dc0f520152855f040/tqdm-4.30.0-py2.py3-none-any.whl
Installing collected packages: tqdm Successfully installed tqdm-4.30.0
After this success message when I'm trying to run my python script I have this error :
androiddl#androiddl:~/...$
python3 download.py "com.facebook.katana" Traceback (most recent call
last): File "download.py", line 10, in
from playstore.playstore import Playstore File "/home/.../playstore/playstore.py",
line 12, in
from tqdm import tqdm ModuleNotFoundError: No module named 'tqdm'
How can I fix it ? Thank you
It seems like pip is hooked up to Python 2, and not python3, which is what you are using to run your script. Try using pip3 instead. If that doesn't work, a quick way to solve it is to use python3 -m pip install ... for now, although it's nice to have that command located at pip3. Try looking at an answer like How to install pip with Python 3? for that.
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