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
Related
I'm learning Python at the moment, and after installing the docx module, I keep getting this error when trying to import it in the Terminal:
import docx
Traceback (most recent call last):
File "", line 1, in
File "/Users/trevorstathatos/Library/Python/3.10/lib/python/site-packages/docx/init.py", line 14, in
from docx.parts.document import DocumentPart
File "/Users/trevorstathatos/Library/Python/3.10/lib/python/site-packages/docx/parts/document.py", line 7, in
from docx.document import Document
File "/Users/trevorstathatos/Library/Python/3.10/lib/python/site-packages/docx/document.py", line 10, in
from docx.section import Section, Sections
File "/Users/trevorstathatos/Library/Python/3.10/lib/python/site-packages/docx/section.py", line 7, in
from collections import Sequence
ImportError: cannot import name 'Sequence' from 'collections' (/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/collections/init.py)
When trying to import it to my Mu Editor, I get this error:
import docx
~/Library/Application Support/mu/mu_venv-38-20211212-105811/lib/python3.8/site-packages/docx.py in
28 TAGS = {}
29
---> 30 from exceptions import PendingDeprecationWarning
31 from warnings import warn
32
ModuleNotFoundError: No module named 'exceptions'
Can someone please help me figure out how to fix this problem? Thanks.
I have readed on internet and a solution may be:
$ pip install python-docx
#instead of pip install docx
(for python 3.x)
Please try this and tell me if works
Link: https://flutterq.com/solved-import-no-module-named-exceptions/
Are you using the most recent version of python-docx? (currently 0.8.11). I found that when I used 0.8.10 python couldn't find all the modules.
You can use where python command in cmd to find the path that python is installed in. then you can use this command -
[python path] -m pip install python-docx
$ pip install python-docx
this worked for me.
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 a new at Python and I have a roblem with installing one framework.
https://github.com/zalando/connexion
I have already used the command in the terminal 'pip install connexion'
But still when I try to start a programm I get such error:
PS C:\Users\fele\OneDrive\Desktop\Python\Uebergabe\pYTHON_BACKEND_2020_03_12> & "C:/Program Files (x86)/Python37-32/python.exe" "c:/Users/fele/OneDrive/Desktop/Python/Uebergabe/pYTHON_BACKEND_2020_03_12/test_local/test_local_application_hook.py"
Traceback (most recent call last):
File "c:/Users/fele/OneDrive/Desktop/Python/Uebergabe/pYTHON_BACKEND_2020_03_12/test_local/test_local_application_hook.py", line 9, in <module>
from cwsm import connexion_manager
ModuleNotFoundError: No module named 'cwsm'
Cannot anybody give me a suggestion why is it happening?
Thanks in advance
The github page shows:
import connexion
So your import is wrong, try using connexion.
Source:
https://github.com/zalando/connexion#running-it
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!
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