I can't seem to run this code in python 3.7.7
import panda as pd
all_data = pd.read_csv('gas_prices.csv')
print(all_data)
Traceback (most recent call last):
File "c:/Users/HP/Desktop/VSc Code/Understanding pand/Sales_analysis/sale_data.py", line 1, in <module>
import panda as pd
File "C:\Users\HP\AppData\Local\Programs\Python\Python37\lib\site-packages\panda\__init__.py", line 1, in <module>
from request import PandaRequest
ModuleNotFoundError: No module named 'request'
I try to change the interpreter but it doesn't seem to make a difference and I don't think I'm in a virtual environment.
This was working a few days ago but suddenly this error started appearing.
accourding to pypi use : pip install request
You've manually installed part of pandas and accidentally named it "panda". Instead use the tool pip, which in Python 3.7.7 is included. Like so:
C:\> C:\Users\HP\AppData\Local\Programs\Python\Python37\Scripts\pip.exe install pandas
Good luck!
Related
When I try to use installed packages in Python, I nearly always run into the same error.
So I e.g. install a package like this: pip3 install mathplot and when I afterwards want to use it in Python3 (I use python3 in the command prompt), I run into the ModuleNotFoundError:
>>> import mathplot
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'mathplot'
But when I run just python, the module is found and ready to use.
Any idea where this problem comes from and how I can get rid of it?
Thanks in advance
I am making a project in Python and first I installed the library using Cmd:
pip install -U hijri-converter
And then I wrote the code for converting the Gregorian year to Hijri:
from hijri_converter import convert
h_date = convert.Gregorian(1982, 12, 2).to_hijri()
print('Hijri', h_date)
But I had this problem:
Traceback (most recent call last):
File "C:\Users\Super\PycharmProjects\pythonProject\python.py", line 2, in <module>
from hijri_converter import convert
ModuleNotFoundError: No module named 'hijri_converter'
How can i solve it?
I solved this problem by going to pyCharm:
File-->Settings-->Project:pythonProject--> python Interceptor-->+(add)-->
search about package 'hijri-converter'--> Install
This link helped me to solve my problem:
https://www.jetbrains.com/help/pycharm/installing-uninstalling-and-
upgrading-packages.html#packages-tool-window
I am having trouble installing the cdstoolbox-remote on my Linux machine (tried both Ubuntu and Debian). I installed it using pip:
pip install cdstoolbox-remote
Which successfully installs the module, but I can't import the module in Python. Importing the module causes the following error:
>>> import cdstoolbox
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/an/miniconda2/envs/tools/lib/python3.7/site-packages/cdstoolbox/__init__.py",
line 8, in <module>
with open(__main__.__file__) as f:
AttributeError: module '__main__' has no attribute '__file__'
What can be done to get it working?
Do you really need cdstoolbox-remote? The standard API for downloading data from CDS would be cdsapi, which can be installed using
pip install cdsapi
or using conda (https://anaconda.org/conda-forge/cdsapi)
I also just tried installing cdstoolbox-remote and got the same problem. But as it is flagged as experimental I even consider it to be possible that the current version is not a stable version.
And cdsapi seems to work.
Actually, the CDSAPI can also be used to execute workflows as follows:
import cdsapi
c = cdsapi.Client()
with open("workflow.py") as f:
code = f.read()
r = c.workflow(code)
print(c.download(r))
For more, read this thread on the Copernicus services documentation.
I'm using Windows 10, and installed Python 3.7.3 using Anaconda3.
I need the following package for using Dakota:
numpy
scipy
pandas
I tested that the python environment is set up properly by executing import numpy, import scipy, and import pandas in command prompt window. I also added the path to environment variable.
However, the python package in Dakota does not work correctly. When I start Python with the python command and then execute the import dakota command, the dakota package is not imported and the following error shows:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'dakota'
I have an issue with the gspread module, and I think with Python 3 too.
My code is something like that: import blabla, gspread, etc...
And if I try to run it python3 myscript.py every module seems to run fine, except gspread. I receive this error:
Traceback (most recent call last):
File "z_schedule.py", line 3, in <module>
from z_database import *
File "/home/pi/Projects/InstaPy/z_database.py", line 3, in <module>
import gspread, gspread_formatting
ModuleNotFoundError: No module named 'gspread'
I'm running python3 and I installed gspread both with pip and pip3. I also installed oauth2 in the same way.
My code used to work great until I updated my Raspberry, InstaPy and Python 3. Somebody knows how to fix it? Thanks.
Try this:
pip3 install gspread
and run the script again. I hope it helps to solve the problem