I have installed pydispatch using - pip install pydispatch - in cmd
C:\Users\masysna1\Desktop\aswath-hiwi\cortex-v2-example-master\Demo>pip install pydispatch
Requirement already satisfied: pydispatch in c:\users\masysna1\appdata\local\programs\python\python310\lib\site-packages (1.1.0)
Requirement already satisfied: six>=1.5.2 in c:\users\masysna1\appdata\local\programs\python\python310\lib\site-packages (from pydispatch) (1.16.0)
Requirement already satisfied: colorama>=0.2.7 in c:\users\masysna1\appdata\local\programs\python\python310\lib\site-packages (from pydispatch) (0.4.4)
but when I run from pydispatch import Dispatcher in python. I get the following error
ImportError: cannot import name 'Dispatcher' from 'pydispatch'
before this was working fine, can anyone help me
Use pip install python-dispatch.
Related
To state from the get go this is no criticism of pythonanywhere, but I want to run a script that used to work using the line:
from flask_cors import CORS
But I get the following error mesage:
ModuleNotFoundError: No module named 'flask_cors'
Then tried to install in my version of python:
pip3.9 install Flask-Cors
The result was:
Defaulting to user installation because normal site-packages is not
writeable Looking in links: /usr/share/pip-wheels Requirement already
satisfied: Flask-Cors in ./.local/lib/python3.9/site-packages (3.0.10)
Requirement already satisfied: Six in
/usr/local/lib/python3.9/site-packages (from Flask-Cors) (1.16.0)
Requirement already satisfied: Flask>=0.9 in
/usr/local/lib/python3.9/site-packages (from Flask-Cors) (2.0.0)
Requirement already satisfied: Werkzeug>=2.0 in
/usr/local/lib/python3.9/site-packages (from Flask>=0.9->Flask-Cors)
(2.0.1) Requirement already satisfied: itsdangerous>=2.0 in
/usr/local/lib/python3.9/site-packages (from Flask>=0.9->Flask-Cors)
(2.0.1 ) Requirement already satisfied: click>=7.1.2 in
/usr/local/lib/python3.9/site-packages (from Flask>=0.9->Flask-Cors)
(7.1.2) Requirement already satisfied: Jinja2>=3.0 in
/usr/local/lib/python3.9/site-packages (from Flask>=0.9->Flask-Cors)
(3.0.1) Requirement already satisfied: MarkupSafe>=2.0 in
/usr/local/lib/python3.9/site-packages (from
Jinja2>=3.0->Flask>=0.9->Flask-C ors) (2.0.1) 15:33 ~$ pip show
Flask-Cors
Name: Flask-Cors Version: 3.0.10 Summary: A Flask extension adding a decorator for CORS support Home-page:
https://github.com/corydolphin/flask-cors Author: Cory Dolphin
Author-email: corydolphin#gmail.com License: MIT Location:
/home/elksie5000/.local/lib/python3.9/site-packages Requires: Six,
Flask
What gives and how do I fix it?
I think you should try the following:
Go to your Bash Console in "Consoles" menu.
Open the bash control
Select your virtualenv:
For example my virtualenv name is flaskapp, I would wirte "workon
flaskapp" in the bash console.
Now type in your desired command
pip3.9 install flask-cors in your case (try in lower case)
Make sure you are working in the same virtualenv and the same python version
(I think you want to make an API using cors maybe)
I was hoping someone could help me out.
System is MacOS Catalina.
Python 3.8
IDE: VS
I installed matplotlib using pip install matplotlib which I saw stuck in under python2.7. I uninstalled matplotlib and reinstalled it using pip3 install matplotlib and received the following message:
Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.7/site-packages (from matplotlib) (0.10.0)
Requirement already satisfied: numpy>=1.11 in /usr/local/lib/python3.7/site-packages (from matplotlib) (1.18.1)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /usr/local/lib/python3.7/site-packages (from matplotlib) (2.4.6)
Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.7/site-packages (from matplotlib) (1.1.0)
Requirement already satisfied: python-dateutil>=2.1 in /usr/local/lib/python3.7/site-packages (from matplotlib) (2.8.1)
Requirement already satisfied: six in /Users/apple/Library/Python/3.7/lib/python/site-packages (from cycler>=0.10->matplotlib) (1.13.0)
Requirement already satisfied: setuptools in /usr/local/lib/python3.7/site-packages (from kiwisolver>=1.0.1->matplotlib) (46.0.0)
However, when I try to run my .py file with 'import matplotlib' it gives this error:
import matplotlib as mpl
ModuleNotFoundError: No module named 'matplotlib'
I've tried searching different sources for the solution but I am now stuck.
You are mostly running your python script with the command python your_file.py, try running as python3 your_file.py in your terminal. pip3 installs packages under python3, not the default python2.
This is because I believe your mac terminal uses python 2.x by default, therefore the command python uses python 2.x version and python3 uses 3.x version that is available to execute the files. So if you want to install any packages under python 2.x you use pip as the command and to install packages under python 3.x you use pip3 as the command
I installed textblob using the command pip install. But now I am trying to import it and I get the following error:
ModuleNotFoundError: No module named 'textblob'
I am using Spyder in a windows 10 system
from textblob import TextBlob
C:\Users\Diego>pip install textblob Requirement already satisfied: textblob in c:\users\diego\appdata\local\programs\python\python36-32\lib\site-packages (0.15.2) Requirement already satisfied: nltk>=3.1 in c:\users\diego\appdata\local\programs\python\python36-32\lib\site-packages (from textblob) (3.4) Requirement already satisfied: six in c:\users\diego\appdata\local\programs\python\python36-32\lib\site-packages (from nltk>=3.1->textblob) (1.11.0)
Requirement already satisfied: singledispatch in c:\users\diego\appdata\local\programs\python\python36-32\lib\site-packages (from nltk>=3.1->textblob) (3.4.0.3)
I dont know why but the solution was to install textblob from the spyder console using:
!pip install textblob
i am learning Python, and have installed python3 through home-brew.
and then i successfully installed BeautifulSoup, and Requests through Pip3.
the codes in terminal
Lorentzs-MacBook-Pro:~ Lorentz$ pip3 install beautifulsoup4
Collecting beautifulsoup4
Using cached https://files.pythonhosted.org/packages/9e/d4/10f46e5cfac773e22707237bfcd51bbffeaf0a576b0a847ec7ab15bd7ace/beautifulsoup4-4.6.0-py3-none-any.whl
Installing collected packages: beautifulsoup4
Successfully installed beautifulsoup4-4.6.0
Lorentzs-MacBook-Pro:~ Lorentz$ pip3 install requests
Requirement already satisfied: requests in /usr/local/lib/python3.6/site-packages (2.19.1)
Requirement already satisfied: idna<2.8,>=2.5 in /usr/local/lib/python3.6/site-packages (from requests) (2.7)
Requirement already satisfied: urllib3<1.24,>=1.21.1 in /usr/local/lib/python3.6/site-packages (from requests) (1.23)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.6/site-packages (from requests) (2018.4.16)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/local/lib/python3.6/site-packages (from requests) (3.0.4)
Lorentzs-MacBook-Pro:~ Lorentz$ python3 /Users/Lorentz/Desktop/py4e/Practice/test.py
Traceback (most recent call last):
File "/Users/Lorentz/Desktop/py4e/Practice/test.py", line 3, in <module>
import BeautifulSoup
ModuleNotFoundError: No module named 'BeautifulSoup'
when i run my python file , it shows
import BeautifulSoup
ModuleNotFoundError: No module named 'BeautifulSoup'
how can i solve this? i have already tried to uninstall python3, and reinstall it through home-brew, and reinstall Pip3, Requests, and beautifulSoup again, but it still shows me the error. Please assist to solve this.
Have you tried this?
from bs4 import BeautifulSoup
I am trying to import matplotlib like so:
import matplotlib.pyplot as plt
For this I have installed matplotlib using.
python -m pip install -U pip setuptools
python -m pip install matplotlib
Although the basic_example.py from the examples worked, it suddenly stopped running along with all other files with matplotlib giving me the below error:
File "matplotlib.py", line 2, in <module>
import matplotlib.pyplot as plt # pyplot module.
ImportError: No module named pyplot`
I tried to check if the module is still there, and it seems to be. What could be possibly wrong?
Requirement already satisfied: matplotlib in c:\python27\lib\site-packages
Requirement already satisfied: numpy>=1.6 in c:\python27\lib\site-packages (from matplotlib)
Requirement already satisfied: python-dateutil in c:\python27\lib\site-packages (from matplotlib)
Requirement already satisfied: cycler in c:\python27\lib\site-packages (from matplotlib)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,>=1.5.6 in c:\python27\lib\site-packages (from matplotlib)
Requirement already satisfied: pytz in c:\python27\lib\site-packages (from matplotlib)
Requirement already satisfied: six>=1.5 in c:\python27\lib\site-packages (from python-dateutil->matplotlib)`
I am using Windows and Python 2.7.
Python 2.7 tries to find modules in the current working directory first, before going into the installed packages, so because you named your test file "matplotlib.py", it will interpret it as the matplotlib package. Rename your test file to something else, and it should be fine