Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

after pip successful installed: ModuleNotFoundError

I am trying to install the SimPy module so that I can use it in IDLE. However, everytime I try to import in IDLE, I got an error. I already tried reinstalling Python and Pip and tried to modify the location of the apps. SimPy can be found in the directory of Python 2.7. I'm using python 3.6.1.

After I correctly installed simpy in the terminal:

pip install simpy
Requirement already satisfied: simpy in /Library/Python/2.7/site-packages

When I put into IDLE:

Import Simpy

I got the error:

    Traceback (most recent call last):
  File "<pyshell#3>", line 1, in <module>
    import simpy
ModuleNotFoundError: No module named 'simpy'

How can I solve this?

like image 955
Robert Avatar asked Jun 13 '17 18:06

Robert


People also ask

Why am I getting modulenotfounderror-no module named'dedupe'?

Maybe your python3 is try to find your script's module in the " /usr/local/lib/python3.x " directory . So if that module is not there then the ModuleNotFoundError: No module named 'dedupe' error is happening .

Why can't I use pip install PySide2?

I'm not exactly sure, but it's possible that you can't use pip install Pyside2because Python only excepts pip install PySide2(Notice the difference in capitalization). Try uninstalling Pyside2 and running pip install PySide2. Share Improve this answer

Why is my Python module not installed in Python?

Python module is not Installed You can get the issue when you are trying to import a module of a library which not installed in your virtual environment. So before importing a library’s module, you need to install it with the pip command. Let’s import an module (requests) into app.py file which is not installed into our virtual environment:

Why doesn't pippoints work with Ami?

It did not work with the old AMI because pippoints tho python2's pipbut the setuptoolsinstalled is for python 3.6. You would probably have needed to install python-setuptools-36.2.7. It probably works on the other AMI because the correct setuptools is already installed.


3 Answers

Since you are using python 3.6.1, you may need to specify the type of python you want to install simpy for. Try running pip3 install simpy to install the simpy module to your python3 library.

like image 195
cosinepenguin Avatar answered Oct 18 '22 19:10

cosinepenguin


Wherever you're running your code, try this

import sys

sys.path
sys.executable

It might be possible that you're running python in one environment and the module is installed in another environment.

like image 11
alok.m Avatar answered Oct 18 '22 18:10

alok.m


When this happened to me (on macOS), the problem turned out to be that the python installation I specified at the top of my script.py was not the same python installation that conda/pip were using on the command line.

To get the command line and my script to match up, I changed the header in my script.py to just use:

#!python

Then when I ran ./script.py on the command line, everything finally worked.

like image 3
Robin Stewart Avatar answered Oct 18 '22 17:10

Robin Stewart