ModuleNotFoundError Even Though Module Shows Up On pip3 list - python

I keep getting this error:
ModuleNotFoundError: No module named 'requestium'
Even though when I do pip3 list, requestium is in there. What are some possible reasons? What can I do to fix this. I'm thinking that its most likely something to do with my files but I can't seem to nail it down.
The line of code where I get the error is,
from requestium import Session

Did you activate your virtual environment? because I can install and use it.
Maybe, you might miss one of the following steps:
Activate your virtual environment: workon vision
Here my virtual environment name is vision
Install your package: pip3 install requestium
Finally use requestium to import Session
If you have done all the steps and still have an error, I suggest create a new environment and apply the three steps. Good luck

Related

impossible to use pip

I start on Python, I try to use mathplotlib on my code but I have an error "ModuleNotFoundError: No module named 'matplotlib'" on my cmd. So I have tried to use pip on the cmd: pip install mathplotlib.
But I have an other error "No python at 'C:\...\Microsoft Visual Studio\...".
Actually I don't use Microsoft Studio anymore so I uninstall it but I think I have to change the path for the pip module but I don't know how... I add the link of the script of the Python folder on the variables environment but it doesn't change anything. How can I use pip ?
Your setup seems messed up. A couple of ideas:
long term solution: Uninstall everything related to Python, make sure your PATH environment variables are clean, and reinstall Python from scratch.
short term solution: Since py seems to work, you could go along with it: py, py -3 -m pip install <something>, and so on.
If you feel comfortable enough you could try to salvage what works by looking at the output of py -0p, this should tell you where are the Python installations that are potentially functional, and you could get rid of the rest.

Why does importing Pytorch in Sublime Text cause a ModuleNotFoundError?

The command 'import torch' causes the build error: 'ModuleNotFoundError: No module named 'torch''.
But when I run the command in the terminal, pytorch works just fine (Python 3.7.X).
Are you using a venvin the project you are right now? If that is so, then you need to install torch in that venv, as it has been created just for the project, so it has not got any extra modules like that one.
Take a look at this. And make sure that the module is in the environment your project is!
In Pycharm for example, whenever you create a new project with a new venv(virtual environment), you need to add to your project settings->interpreter settings the module manually, so it can be imported. Because it may be installed in your system, but not in that venvspecifically, which will look in there!
try this
link
it might help.
Also Faced similar issue in Windows 10 with Anaconda installed. Installed pytorch package using conda install command which I found here: http://pytorch.org/
The usual import from command-line worked for my environment(torch):

How can I make this script run

I found this script (tutorial) on GitHub (https://github.com/amyoshino/Dash_Tutorial_Series/blob/master/ex4.py) and I am trying to run in my local machine.
Unfortunately I am having and Error
I would really appreciate if anyone can help me to run this script.
Perhaps this is something easy but I am new in coding.
Thank you!
You probably just need to pip install the dash-core-components library!
Take a look at the Dash Installation documentation. It currently recommends running these commands:
pip install dash==0.38.0 # The core dash backend
pip install dash-html-components==0.13.5 # HTML components
pip install dash-core-components==0.43.1 # Supercharged components
pip install dash-table==3.5.0 # Interactive DataTable component (new!)
pip install dash-daq==0.1.0 # DAQ components (newly open-sourced!)
For more info on using pip to install Python packages, see: Installing Packages.
If you have run those commands, and Flask still throws that error, you may be having a path/environment issue, and should provide more info in your question about your Python setup.
Also, just to give you a sense of how to interpret this error message:
It's often easiest to start at the bottom and work your way up.
Here, the bottommost message is a FileNotFound error.
The program is looking for the file in your Python37/lib/site-packages folder. That tells you it's looking for a Python package. That is the directory to which Python packages get installed when you use a tool like pip.

Trouble importing python packages using PyCharm

I've been trying to install simple packages for python such as numpy and pandas, and while I am able to install the package manually from the command line using pip as soon as I try to import it PyCharm can't find it. I have manually configured the path, with no luck.
PyCharm can also not find the packages I want to install itself and produces a connection timeout, this could be because I am working from a secure network.
Still pretty new to python and software dev in general, I apologise in advance if I'm being stupid, but no other similar threads are solving the issue.
I am operating on windows 7. The error I get is:
C:\Users\james.alexander\PycharmProjects\Test.py\venv1\Scripts\python.exe C:/Users/james.alexander/PycharmProjects/Test.py/testfile.py
Traceback (most recent call last):
File "C:/Users/james.alexander/PycharmProjects/Test.py/testfile.py", line 1, in <module>
import numpy
ModuleNotFoundError: No module named 'numpy'
I think PyCharm use a virtualenv, installing via pip won't work since it will install the package in your local env.
Check https://www.jetbrains.com/help/pycharm/installing-uninstalling-and-upgrading-packages.html
Try This:
Step 1: Ctrl+Alt+s
Step 2: Look for Project Interpreter Under Project
Step 3: Look for + In the right corner of prompt box.
Step 4: Search and select your required package. And Install button is just below.
First check the Project Interpreter in your pycharm.
File > Settings >Project >Project Interpreter
Check the version of python there (python2 or python3)
And check if you are using any virtual environment
And see what version python you have installed
For python3 you may have to use "pip3 install pkgname"
For python2 use "pip install pkgname"
In PyCharm, you can install modules from within the app. Simply access your preferences, then under 'Project Interpreter', you will find a table containing your installed modules. To install a new one, click the + symbol on the bottom - left, then search for the appropriate package, e.g. numpy. Once you've found it, simply click 'Install Package'. The module is now installed and ready to use!
EDIT: I've just seen that someone else has already posted this answer, sorry about that :)

Cannot import name random/multiarray in conda environment

I'm trying to run tensorflow in a conda environment. I started off by creating a python 2.7 environment with conda create --name py27 python=2.7 and then activated it. Within the environment, I ran conda install -c https://conda.anaconda.org/jjhelmus tensorflow, which has tensorflow and numpy in the package, so hypothetically there shouldn't be any issues running numpy.
When I open up the python console within the environment, however, I'm continually getting ImportError: No module named multiarray and ImportError: cannot import name Random (I can import random with no issues, but then I get the multiarray issue) no matter how many times I uninstall/reinstall numpy/matplotlib (at one point I even uninstalled/reinstalled python) and no matter what versions of these I try to use, I keep on getting the same issue. What should I do?
There is an answer here.
Shortly: that issue has something with the version of numpy which is upgraded by another package by whatever reason. Try to specify version: conda create -n NAME numpy=1.9.3 other_package.
If that doesn't work, check if you have files in your working directory which names matches the names of some packages. For example, I had a similar problem after renaming numpy.py.txt (which is a sort of handmade cheatsheet) into just numpy.py and trying to import numpy within Python shell when I was in that directory.

Categories