ModleNotFoundError: No module named ‘cftime._cftime’ - python

I installed cftime 1.5.0 from anaconda archive, but error occurs when importing the cftime.
I already checked that is installed via ‘conda list’.
Can i know what the problem is?
I’m using python 3.7 via anaconda in Redhat 6.9.
import cftime
Traceback (most recent call last):
...
...
from ._cftime import (datetime,real_datetime,
ModuleNotFoundError: No module named ‘cftime._cftime’

When using Anaconda you need to activate an environment before you can actually use it. This is what is happening when you open the Anaconda prompt. Alternatively you can open any shell and run
conda activate
Only afterwards you should run
python
and import your packages. The misconception about activation comes from the fact that people keep adding the Python path to their environment. But this only allows to run Python and it's standard packages.

Related

ModuleNotFound error but module has just been installed

I'm using Windows 10, Python 3.6.4. I'm trying to use the module Pyperclip and have installed it with pip:
c:\Users\Bertie>pip install pyperclip
Requirement already satisfired: pyperclip in c:\python36\lib\site-packages (1.8.0)
But when I try to run a program which uses this module, I get this error:
c:\Users\Bertie\scraping.py test
Traceback (most recent call last):
File "C:\Users\Bertie\scraping.py", line 3, in <module>
import webbrowser, sys, pyperclip
ModuleNotFoundError: No module named 'pyperclip'
How can I fix this? Thank you.
The reinstall trace shows you install the packge successflly for python36.
Check if there is more than one python in your system. Type "python" in your windows cmd console, and check the python version to see if python36 is the default one. Then explicitly use the python interpreter to start the script "python your_python_script.py".
Where is the py file? Maybe try cd-ing into the folder and run python (python3) scraping.py?
Also check that you have installed the correct interpreter and are using the correct version of python.
Maybe You Installed pyperclip in conda env or a virtualenv and you forgot to activate it ?
Because This Has Happened To Me Many Times.
Or Maybe You Have 2 Instances Of Python installed on your computer and you accidentally installed pyperclip in the other instance of python ?

ModuleNotFoundError: No module named 'pynput' Python3 and pip3

I want to use 'pynput', so I used pip to add it to my environment.
The installation proceeds without problem.
But I am unable to import it into my project.
I am using python 3.8.1 on my environment.
I used pip3 for installation.
I have already tried to install pynput, uninstall it and reinstall it multiple times.
My .py file doesn't have a confusing name like "pynput.py"
I am comfortable with my environment when I try to execute my file.
I am trying to run from my terminal or VSCodium, and neither of them works.
And I work on Debian 10.
pip freeze :
pynput==1.6.7
python-xlib==0.26
six==1.14.0
Traceback :
Traceback (most recent call last):
File "./play.py", line 6, in <module>
from pynput import keyboard
ModuleNotFoundError: No module named 'pynput'
So I don't understand why it doesn't work.
thank you in advance for your help :)
When creating my project, I was not working under an environment, so I used the classic shebang: #!/bin/python3.
Then, I went under an environment to use pynput, but I just forgot to change my shebang to #!/usr/bin/env python.
So, actually, I didn't risk finding pynput
It might be possible you have two versions. Rry installing with python3 -m pip install pynput or you should use some older version of Python. I am using 3.7.5 and its works perfect for me.
Try importing from the terminal.

Python Virtualenv : ImportError: No Module named Zroya

I was trying to work with python virtualenv on the Zroya python wrapper around win32 API. Although I did installed the modules using pip, and although they are shown in cli using the command
pip freeze
,when trying to execute the .py file that uses the modules it shows the following error.
Traceback (most recent call last):
File "TesT.PY", line 2, in <module>
from zroya import NotificationCenter
ImportError: No module named 'zroya'
What is the reason for this cause ? I'm using python 3.4. When checked on
>>>help("modules")
on python cli, the modules that were installed using pip aren't listed.
Your virtualEnv is separate from OS Python environment.
Check whether you installed 'zroya' module in OS Python env or virtualEnv.
Run bin/activate in your virtual env, and check if 'zroya' module exists
>>>help("modules")
If no module named Zroya, run install command pip install xxx after activating virtual env.
Installing zroya should solve your problem.
Installation instructions: https://pypi.python.org/pypi/zroya
There seems to be some issue with the pip install. Copying the zroya directory from github repository over to PYTHONPATH resolved the conflict.

Tensorflow in windows using python pip

Installed python 3.5.2 and also tensorflow using pip command but getting error while importing tensorflow package.
Used command as import tensorflow as tf to import tensorflow. But got error as;
Traceback (most recent call last):
File "", line 1, in
ImportError: No module named 'tensorflow'
How can I rectify this error?
Can I get answer for this as soon as possible..
Are you running on a IDE or ipython or Jupyter?
If yes, it's likely the IDE is using a different python such as virtualenv. It's possible there are multiple pythons installed in your system.
Open cmd and try the following
$ where python
$ python -c "import tensorflow"
Make sure the path you get is same as the installation path.
If there is still an error, compare with this path
$ where pip
It's possible your system is using a different python path if there are multiple python.

Python - import error when trying to activate a virtual environment, or lauch Spyder

I get an ImportError whenever I try to activate a virtual environment, or when I try to launch Spyder.
When trying to activate a virtual environment:
Traceback (most recent call last):
File "/home/pauline/anaconda3/bin/conda", line 3, in <module>
from conda.cli import main
ImportError: No module named conda.cli
When trying to open spyder:
Traceback (most recent call last):
File "/home/pauline/anaconda3/bin/spyder", line 2, in <module>
from spyderlib import start_app
ImportError: No module named spyderlib
I tried to find an answer for that but I could mainly find problems occurring after Anaconda was just installed (mine has been installed previously and was working fine up until yesterday).
I have also tried this answer and this answer but they did not solve the problem.
The only think I can think of which may have provoked this error is that I changed the interpreter used by Spyder yesterday from the default Anaconda Python interpreter to an interpreter from a virtual environment created with virtualenv. Even then, I could close and restart Spyder with no problems, and the errors started after I rebooted my computer.
[edit] I should add that both Anaconda and my virtual environment use the same version of Python which is Python 3.5
If you are using a different python version, whatever packages that you had with anaconda or that you may have installed with conda install will not be there on the new version. You need to install them with pip or conda again.

Categories