I am trying to follow a tutorial book called "Data visualization with Python and Javascript" and am running into many issues importing modules used in the book. I have made sure to do "pip install" on as many of the packages used as possible, and have successfully done it for packages such as SQLAlchemy and matplotlib.
However, when I import modules from SQLAlchemy and even dateutil that are used in the tutorial, I receive an import error, "ImportError: No module named {module}"
On the following lines of code:
from dateutil import parser
from SQLAlchemy import create_engine
This has occurred often enough with different modules that I am beginning to get concerned I can no longer actually follow the tutorial. I had to skip a whole section of how to use SQLAlchemy.
Furthermore, SQLAlchemy is properly installed:
Requirement already up-to-date: sqlalchemy in c:\users\{user}\appdata\local\continuum\miniconda3\lib\site-packages (1.2.15)
What obvious thing am I missing here that needs to happen for me to use these packages and modules?
EDIT:
python --version
Python 3.7.1
pip --version
pip 18.1 from C:\Users\{user}\AppData\Local\Continuum\miniconda3\lib\site-packages\pip (python 3.7)
However, I am using Anaconda for a virtual environment, and PyCharm as my IDE. I have included a screenshot of the projects interpreter for a good measure.Project Interpreter
Furthermore, I have checked that I have pip installed it on both the root and the environment.Root Environment
I think, you have multiple python versions installed.(2.* | 3.*)
You are installing packages in one python version and using another python version.
EDIT:
You can use pip2 install modulename for python2
and pip3 install modulename for python3
Related
Probably stupidly I tried to install the latest version of Python, in this case using the download from python site, but after doing that I was then getting python still running on the previous version python-3.6. I'm on OSX and was using sublime.
So I have been trying to work out how to update it to use the newest version. I've followed; https://opensource.com/article/19/5/python-3-default-mac.
All of the responses to queries now point to the python-3.9.5 version. So that's great and my runtime is using that. However after installing the requests using pip install I get the following error when running.
import requests
ModuleNotFoundError: No module named 'requests'''
[path: /Library/Frameworks/Python.framework/Versions/3.9/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin]
I stumbled upon Modules are installed using pip on OSX but not found when importing which I have been trying to work through.
I have been able to run the import command successfully in terminal, however it's intermittent as I've tried again and it's broken, so I'm lost. I'm running it something trying to run the python3.6 version, which after updating I followed these instructions to remove when I have uninstalled that from my mac https://www.macupdate.com/app/mac/5880/python/uninstall.
If there is any ideas, would love some help, mainly to try and tell me what that error message is telling me.
In particular, what does this mean?
[path: /Library/Frameworks/Python.framework/Versions/3.9/bin:/Library/Frameworks/Python.framework/Versions/3.6/
I should clarify too; when I run 'pip list'
I see
requests 2.25.1
Assuming that you are not installing requests package properly, and assuming your python executable is named python:
python -m pip install requests
If however, your python executable is named something else instead, e.g. python3, replace python with that name:
python3 -m pip install requests
I have quite a few versions of python installed (running macOS). I installed scrapy with pip install scrapy, and it succeeded. When I use it e.g.
scrapy startproject newProject
I see ModuleNotFoundError: No module named 'six', indicating that I need to install that module (six).
Note: I could easily fix the specific error by installing six for all versions of python installed, but solving that problem isn't what I'm trying to work out here.
Specifically what I'm after here is how to know what version of python a command line utility is using when it runs?
pip install will install package under pythonxxx/site-packages, the concrete location is up to which python version the pip used.
use pip -V to see the pip path and the related Python version. For you question, missing six module, pip install six should be enough, which will install six to the same Python version of scrapy.
After install scrapy, we could also enter scrapy shell, and use the below code to see where scrapy is
scrapy.__file__
To check the version of python from within a script or the REPL you can use the sys module.
For example:
>>> import sys
>>> sys.version
'3.8.5 (default, Jul 21 2020, 10:48:26) \n[Clang 11.0.3 (clang-1103.0.32.62)]'
i installed python3.7 on ubuntu using ppa:deadsnakes/ppa repository.
When I try to run
import cmath
in python shell it fails with message:
ModuleNotFoundError: No module named 'cmath'
I didn't find any info about depracation of this library or anything in python3.7 changelog. It works fine in pythons 3.5 and 2.7. I tried installing it on different ubuntu virtual machines and computers and I always get the same result.
Do I need to install some specific library or something (which I doubt because the module is listed in standard library https://docs.python.org/3/library/index.html) or is problem elsewhere?
This was a bug in the deadsnakes backport of python3.7 specifically for xenial.
During the 3.7 beta period (when the package was imported). The cpython build system used PY_CORE_CFLAGS as a make variable. It was later changed to PY_STDMODULE_CFLAGS. debian ships a patch with their package that adjusts a generated makefile line using a sed expression for that specific variable. Since this was missing it caused the cmath module to build incorrectly.
This has been fixed in this commit
This fix is available in 3.7.0-1+xenial2 (debian version)
I installed python3.7 by downloading and installing it using make and cmath started working. It looks like ppa:deadsnakes/ppa repository had missing cmath module.
I just started learning Python and a bit confused about how packages are distributed and installed. I am aware of helper scripts easy_install and pip which can be used to install the dependent modules,howerver I am not clear how to do with programatically,can someone help me on this?
How to install dependent modules automatically when running python applications? I have a dependency on subprocess32 and other modules,I want to automatically install them if they are not present....
File "script.py", line 6, in <module>
import subprocess32 as subprocess
ImportError: No module named subprocess32
I have looked at some posts online below but not clear...really appreciate guidance here
locallyoptimal.com/blog/2014/03/14/executable-python-scripts-via-entry-points/
Python packages installation in Windows
Easiest way to handle module installs within a program is with pip:
import pip
pip.main(["install", "numpy"])
For example will install numpy and its dependencies. You can also specify versions using numpy=xxx, or upgrade by passing "-upgrade" between those two above.
I've been trying for a couple of hours already. It seems IDLE can't find any third-party module. I am a Python beginner.
Here is some info about my system:
OSX version: 10.11.5
python version: Python 2.7, Python 3.4, Python 3.5
The initial installation using pip (among other methods) seems to work fine. When I repeat the installation, terminal responds with:
Requirement already satisfied (use --upgrade to upgrade): pyperclip in
./anaconda/lib/python3.4/site-packages
However, when I go to IDLE (Python 3.4) and try to import the module, IDLE responds with:
Traceback (most recent call last): File "", line 1, in
import pyperclip ImportError: No module named 'pyperclip'
I have read that it may have something to do with my PATH or some virtual environment. I’ll be frank, I’m not sure what to make of these as they seem beyond my current ability.
This inability to import modules is becoming an almost insurmountable roadblock to advancing with Python. If you can offer any ideas on what I can do or can ELI5 the solution, I am forever in your debt?
It seems you are using conda, but you are trying to install the pyperclip module with pip. Have you tried running conda install pyperclip?
As stated here:
Because Conda introduces a new packaging format, you cannot use pip and Conda interchangeably; pip cannot install the Conda package format. You can use the two tools side by side but they do not interoperate either.