I am trying to import Yql but it throws the following error.I am using using ubuntu 10.04.
>>>import yql
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/yql/__init__.py", line 563, in <module>
class YahooToken(oauth.Token):
AttributeError: 'module' object has no attribute 'Token'
Any ideas on how to fix this?
Solved it.
There were other libraries that were messing with Yql.I removed python-oauth2,oauth2,Yql and reinstalled Yql.
sudo pip uninstall python-oauth2
sudo pip uninstall oauth2
sudo pip uninstall yql
sudo pip install yql
Related
On my raspberry pi 4 I tried to code some basic stuff (like printing messages) to test out the pymodbustcp. I got the code from the pymodbustcp wiki so that shouldn't give the problem.
For some reason, it doesn't want to find the module of pymodbustcp and it gives this message below when I run the code. I think it has to do with pip but I am not sure
/home/pi/Desktop/Laadpunt/venv/bin/python /home/pi/Desktop/Laadpunt/main.py
Traceback (most recent call last):
File "/home/pi/Desktop/Laadpunt/main.py", line 7, in <module>
from pyModbusTCP.client import ModbusClient
ModuleNotFoundError: No module named 'pyModbusTCP'
Process finished with exit code 1
I installed both "sudo pip2 install pyModbusTCP" as "sudo pip3 install pyModbusTCP" in my console and that says:
pi#raspberrypi:~ $ sudo pip install pyModbusTCP
Traceback (most recent call last):
File "/usr/local/bin/pip", line 6, in <module>
from pip._internal.cli.main import main
ModuleNotFoundError: No module named 'pip._internal.cli.main'
pi#raspberrypi:~ $
What could be the reason for the issue and how would I fix it?? If you need any info from commands tell me which ones.
sudo pip is not the way to go to install to your venv.
You should install to your venv specifically by doing
/home/pi/Desktop/Laadpunt/venv/bin/python -m pip install ...
So, this was my first time making a python package. I tried and tested and got it to work. This meaning that pip install . didn't complain and that
$sudo python3
>>>from LEDController import prettyLight
>>>prettyLight().light('whatsapp',100)
provided expected output and actions in my LED matrix.
Also pip list includes LEDControllerm but as soon as I start python3 anywhere but in the LEDController package directory, the module is not being found.
Running pip install /path/to/LEDController/ is still successfull, as is pip3 install /path/to/LEDController/.
Yet I get
$sudo python3
>>> import LEDController
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'LEDController'
>>> from LEDController import prettyLight
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'LEDController'
What am I missing?
As #sinoroc said, installing only using pip is not the safest option. Instead using python3 -m pip install /path/to/module fixed the issue perfectly.
I'll put his link here so future viewers can read up on why this is.
I've tried to install requests module (Debian, Python 2.7) by pip install requests command. Output was:
Installing collected packages: urllib3, requests
Successfully installed requests-2.18.4 urllib3-1.22
Tried following the following Quickstart tutorial but I get the following error at import requests
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "requests/__init__.py", line 76, in <module>
check_compatibility(urllib3.__version__, chardet.__version__)
AttributeError: 'module' object has no attribute '__version__'
Any help?
Problem was with chardet package. Uninstalled it (pip uninstall chardet) and installed again and now it works. Cheers!
I'm using ubuntu and I got python 2.7 and python 3.4.3 installed on my OS.
I'm trying to upgrade to Django 2. ButI get this error while trying to install it using pip install -U Django or pip install Django --upgrade:
Traceback (most recent call last): File "", line 17, in
File "/tmp/pip_build_alex/Django/setup.py", line 32, in
version = import('django').get_version() File "django/init.py", line 1, in
from django.utils.version import get_version File "django/utils/version.py", line 61, in
#functools.lru_cache() AttributeError: 'module' object has no attribute 'lru_cache' Complete output from command python setup.py
egg_info: Traceback (most recent call last):
File "", line 17, in
File "/tmp/pip_build_alex/Django/setup.py", line 32, in
version = import('django').get_version()
File "django/init.py", line 1, in
from django.utils.version import get_version
File "django/utils/version.py", line 61, in
#functools.lru_cache()
AttributeError: 'module' object has no attribute 'lru_cache'
I've read this question and another one, only to see that answers are offering OP to install a lower version of django!, but that's not a real answer to such question.
I tried alias python=python3 to set python 3 as default python but failed to get a working solution.
How can I install Django 2 in a OS with 2 versions of python without getting this error?
I solved the issue by installing django using pip3. But since I didn't have pip3 package installed on my OS, first I had to install it using:
sudo apt-get update
sudo apt-get -y install python3-pip
Then I successfully installed Django 2.0 using:
pip3 install Django --upgrade
I tried many things but I could not install dbus package for python3.
I believe this command install the dbus for python3:
sudo apt-get install python3-dbus-dbg
However I still get this error:
>>> import dbus
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'dbus'