ModuleNotFoundError no module named onetimepad? - python-3.x

i have deployed my web app on pythonanywhere website and the website is working properly but i also created the virtualenv where i installed my app packages everything is working fine
but when i import the new packages in the file in my pyton file like import onetimepad as onetimepad
it gives me error given below
ModuleNotFoundError: no module name 'onetimepad'
How to get rid of from this error Any help would be appreciated thanks in Advance

finally i found out the solution my python version is 3.8
pip3.8 install onetimepad

Related

Python Module not found, but it is installed?

I wanted to make an Instagram bot so I can automate my posts and whatever. My problem is, I get the following Error when I try importing the module/library named "instagrapi":
Exception has occurred: ModuleNotFoundError
No module named 'instagrapi'
File "C:\Users\Simon\Desktop\Py\bot.py", line 1, in <module>
from instagrapi import Client
the error is in line 1 of my code, which simply states "from instagrapi import Client"
Now to my question: I already installed instagrapi, but VSCode tells me I didn't. I installed Python 3.11 but it runs in 3.10 or what so ever.
If someone can help me, please do so, thanks in advance
I tried reinstalling the library and restarting vscode, but it didn't help.
I'm running out of ideas

Why am I getting ModuleNotFoundError: No module named 'dpkt'?

When I run
import dpkt
It gives
ModuleNotFoundError: No module named 'dpkt'
But I already installed dpkt.
install dpkt cmd
Does anyone know how I can fix this?
I am using window10, python3.
I had the same issue today. I found out that when I installing the dpkt module, it was getting installed onto an environment different than the one I was using in pyCharm.
I found the answer to this post very helpful to explain my issue: https://stackoverflow.com/a/52608375/2411380
I fixed my issue by using the terminal inside pyCharm to install dpkt, then it worked.
I also found a suggestion to use all packages installed in conda inside pyCharm: https://stackoverflow.com/a/49097897/2411380

ModuleNotFoundError: No module named 'zope.deprecation'

Okay, I have lost a day in debugging the script and now I don't have any other option to post a question on StackOverflow. I have a python script which installs Apache Airflow on the machine using a requirement.txt file nothing rocket science simply
sudo pip3 install -r requirement.txt
The problem is during installation I am getting an exception
ModuleNotFoundError: No module named 'zope.deprecation'
at a line which is trying to execute following statement
from airflow.models.variable import Variable
The script has three stages
First: It updates the OS using somewhat apt-get update and also installs some system libraries
Second: It invokes airflow initdb etc
Third: It actually tries to create some specific entries in airflow meta-database, and Its here in this stage I am invoking the statement from airflow.models.variable import Variable which throws an exception
I install all dependencies in stage First so the Module zope.deprecation is also installed via requirement.txt file. The module is there in site-packages folder but It doesn't get imported and throws an exception
I know there are already 7700+ question with title ModuleNotFoundError on StackOverflow and I don't declare that I checked out them all but I did my homework and tried various solutions but none are working for me, Few links I checked out are below
adding directory to sys.path /PYTHONPATH
Unable to import a module that is definitely installed
Python: Installed a local package with pip3, but got module not found error
I can't share the code because of policy issues, but I hope you guys understand.
Any help would be appreciated!
there is a error by zope and zope.deprecation.
you can do this:
pip uninstall zope
pip uninstall zope.deprecation
and then:
pip install zope.deprecation

ModuleNotFoundError: No module named 'flask_wtf' in python

I'm new to python so please be patient if i ask a silly question.
I am trying to use flask wtf class as seen in a tutorial.
My first line of the program is
from flask_wtf import FlaskForm
It gives me the error ModuleNotFoundError: No module named 'flask_wtf'
I have followed the following steps to make sure i have activated the virtual environment and flask wtf was installed in the virtual environment and not global.
Step 1: Went to the virtual environment and activated the environment C:\Users\Shraddha\PycharmProjects\FlaskProject\venv\scripts activate
Step 2: Installed flask wtf
C:\Users\Shraddha\PycharmProjects\FlaskProject\venv\scripts pip install flask-wtf
I see that flask-wtf is installed correctly in the folder C:\Users\Shraddha\PycharmProjects\FlaskProject\venv\Lib\site-packages
However when i try to run it using command prompt it does not give me anything and when i try to run it using sublime text it gives me ModuleNotFoundError: No module named 'flask_wtf' error.
I know this is a flask_wtf import error because other programs are executing as expected. Any help ?
If you start your virtual environment in the same dir as the file you are running doesn't that give access to the libraries in the install (ie everything shown in 'pip freeze' for the env)?
I faced same issue and tried all the approaches given on stackoverflow ImportError: No module named flask_wtf but didn't work for me.
I am using ubuntu 20.04 LTS operating system.
Note: To follow the given step you must activate your virtual environment.
I used:
pip3 freeze
which listed following directories
libries in my virtual environment
Then i tried the below command in the same directory
git clone git://github.com/lepture/flask-wtf.git
cd flask-wtf/
python3 setup.py install
Through the above commands i successfully installed flask_wtf as show below
installed flask_wtf
but then i faced the below error as i used email_validator in my forms.py file:
Exception: Install 'email_validator' for email validation support
Then I installed email_validator using following command
pip3 install email_validator
Then i successfully run my flask application. I am sure it will work for you too.

ModuleNotFoundError: No module named 'gather_keys_oauth2'

I am trying to create a Python Script to get my hands on my Fitbit data so that I can alternately integrate it with another API. I have been following the instruction on this website https://towardsdatascience.com/collect-your-own-fitbit-data-with-python-ff145fa10873
I have used pip to install Fitbit, Pandas, DateTime and also Oauth. To install OAuth I used the following:
pip install oauth -t fitbitAPI
It installed without any issue.
I put the following lines into my Python Script:
import fitbit
import gather_keys_oauth2 as Oauth2
import pandas as pd
import datetime
When I test the script I get the following error message:
Traceback (most recent call last):
File "fitbitAPI.py", line 2, in <module>
import gather_keys_oauth2 as Oauth2
ModuleNotFoundError: No module named 'gather_keys_oauth2'
I spent hours searching the web but have not been able to find anything that's been helpful. Any ideas? Is there another version or way that I need to install OAuth?
Here's how I was able to resolve the error:
Download the fitbit package as described (https://github.com/orcasgit/python-fitbit).
After you install fitbit as described, navigate to the newly created folder \Lib\site-packages\fitbit
Copy and paste the gather_keys_oauth2.py file into the fitbit folder
Then you can from fitbit import gather_keys_oauth2 as Oauth2
One clarification on Jacob Miller's solutions:
Copy and paste the gather_keys_oauth2.py file into the fitbit folder
copy gather_keys_oauth2.py into the Lib/site-packages folder if the above still results in the not found error.
And, I installed cherrypy (required by gather_keys_oauth2.py) using the Anaconda Navigator:
screen shot from Navigator
good luck.
You should be able to source the module from orcasgit. You can download the python script here and stick it in your directory.
I experienced a similar issue and solved by updating my environment and making sure I was using python3. I had activated the wrong environment with the conda activate environmentname command, and so the notebook was throwing this same error.
Install Anaconda-Navigator
Create a new environment with the Anaconda-Navigator tool
Make sure you are using Python 3.x in this new environment
Install cherrpy using the Anaconda-Navigator tool
When you start-up terminal and navigate to the directory of your app, you'll activate your environment with conda activate environmentname and then start up your notebook jupyter notebook. This error should disappear.
Note: there may be some additional packages you need to install. Keep using the anaconda navigator to continue installing the packages; the error messages coming off the notebook will guide you to install the right packages.

Resources