Problems importing quandl module - python

I am trying to create a Data Science project using some Quandl dataset, but am receiving an error on import.
As i know quandl should be imported all in lowercase, as the documentation states here and here, my import goes as follows:
import quandl
Error:
ModuleNotFoundError: No module named 'quandl'
I installed quandl using pip install quandl. My pip list output is:
Package Version
--------------- ---------
asn1crypto 0.24.0
certifi 2019.6.16
cffi 1.12.3
chardet 3.0.4
cryptography 2.7
idna 2.8
inflection 0.3.1
more-itertools 5.0.0
ndg-httpsclient 0.5.1
numpy 1.16.4
pandas 0.24.2
pip 19.1.1
pyasn1 0.4.5
pycparser 2.19
pyOpenSSL 19.0.0
python-dateutil 2.8.0
pytz 2019.1
Quandl 3.4.8
requests 2.22.0
setuptools 41.0.1
six 1.12.0
urllib3 1.25.3
wheel 0.33.4
wincertstore 0.2
I don't have pip3, as I installed Python through my Anaconda installation. I am running a Jupyter Notebook in a virtual environment I created just for this project. Just so you know, python --version output is:
Python 3.7.3
The strange part occurs when i try running a one line python script with import quandl. This time the program runs without errors, which means that the cause of the ModuleNotFoundError: No module named 'quandl' is the jupyter notebook, which is not being able to properly find the quandl module.
As a last resource, I tried installing quandl inside jupyter notebook:
!pip install quandl
import quandl
Output:
Requirement already satisfied: quandl in c:\users\not_me\.conda\envs\quant\lib\site-packages (3.4.8)
Requirement already satisfied: pandas>=0.14 in c:\users\not_me\.conda\envs\quant\lib\site-packages (from quandl) (0.24.2)
Requirement already satisfied: pyOpenSSL in c:\users\not_me\.conda\envs\quant\lib\site-packages (from quandl) (19.0.0)
Requirement already satisfied: inflection>=0.3.1 in c:\users\not_me\.conda\envs\quant\lib\site-packages (from quandl) (0.3.1)
Requirement already satisfied: numpy>=1.8 in c:\users\not_me\.conda\envs\quant\lib\site-packages (from quandl) (1.16.4)
Requirement already satisfied: more-itertools<=5.0.0 in c:\users\not_me\.conda\envs\quant\lib\site-packages (from quandl) (5.0.0)
Requirement already satisfied: pyasn1 in c:\users\not_me\.conda\envs\quant\lib\site-packages (from quandl) (0.4.5)
Requirement already satisfied: python-dateutil in c:\users\not_me\.conda\envs\quant\lib\site-packages (from quandl) (2.8.0)
Requirement already satisfied: six in c:\users\not_me\.conda\envs\quant\lib\site-packages (from quandl) (1.12.0)
Requirement already satisfied: ndg-httpsclient in c:\users\not_me\.conda\envs\quant\lib\site-packages (from quandl) (0.5.1)
Requirement already satisfied: requests>=2.7.0 in c:\users\not_me\.conda\envs\quant\lib\site-packages (from quandl) (2.22.0)
Requirement already satisfied: pytz>=2011k in c:\users\not_me\.conda\envs\quant\lib\site-packages (from pandas>=0.14->quandl) (2019.1)
Requirement already satisfied: cryptography>=2.3 in c:\users\not_me\.conda\envs\quant\lib\site-packages (from pyOpenSSL->quandl) (2.7)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in c:\users\not_me\.conda\envs\quant\lib\site-packages (from requests>=2.7.0->quandl) (3.0.4)
Requirement already satisfied: idna<2.9,>=2.5 in c:\users\not_me\.conda\envs\quant\lib\site-packages (from requests>=2.7.0->quandl) (2.8)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\not_me\.conda\envs\quant\lib\site-packages (from requests>=2.7.0->quandl) (2019.6.16)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in c:\users\not_me\.conda\envs\quant\lib\site-packages (from requests>=2.7.0->quandl) (1.25.3)
Requirement already satisfied: asn1crypto>=0.21.0 in c:\users\not_me\.conda\envs\quant\lib\site-packages (from cryptography>=2.3->pyOpenSSL->quandl) (0.24.0)
Requirement already satisfied: cffi!=1.11.3,>=1.8 in c:\users\not_me\.conda\envs\quant\lib\site-packages (from cryptography>=2.3->pyOpenSSL->quandl) (1.12.3)
Requirement already satisfied: pycparser in c:\users\not_me\.conda\envs\quant\lib\site-packages (from cffi!=1.11.3,>=1.8->cryptography>=2.3->pyOpenSSL->quandl) (2.19)
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-1-614264e6071a> in <module>
1 get_ipython().system('pip install quandl')
----> 3 import quandl
ModuleNotFoundError: No module named 'quandl'

Try pip3 install quandl . It usually works for Python 3.x

You can use pip using the module syntax rather than the standalone CLI for when you want to make sure you are using the version of pip associated with that interpreter.
python -m pip install quandl
Or, since you are using Conda, you could also try installing quandl with the conda CLI.
conda install quandl (or whatever the package's name is for conda).

Try installing it by running
!pip install quandl
In a cell in a Jupyter notebook. If you have things set up correctly, there's a chance that will be the same version of pip you need.

The problem was that Jupyter was not properly recognizing my virtual environment. I found my answer here, the workaround is pretty self explanatory.

Related

Library issue in python spyder

I am new to Python. I have downloaded pysnmp in spyder. But when I run my code, it shows no module named pysnmp.
!pip install pysnmp
Requirement already satisfied: pysnmp in c:\users\maxuser\appdata\local\programs\python\python311\lib\site-packages (4.4.12)
Requirement already satisfied: pysmi in c:\users\maxuser\appdata\local\programs\python\python311\lib\site-packages (from pysnmp) (0.3.4)
Requirement already satisfied: pycryptodomex in c:\users\maxuser\appdata\local\programs\python\python311\lib\site-packages (from pysnmp) (3.17)
Requirement already satisfied: pyasn1>=0.2.3 in c:\users\maxuser\appdata\local\programs\python\python311\lib\site-packages (from pysnmp) (0.4.8)
Requirement already satisfied: ply in c:\users\maxuser\appdata\local\programs\python\python311\lib\site-packages (from pysmi->pysnmp) (3.11)
[notice] A new release of pip available: 22.3.1 -> 23.0
[notice] To update, run: python.exe -m pip install --upgrade pip
But upon running the code this is shown...
File c:\users\maxuser\untitled0.py:1
from pysnmp.entity.rfc3413.oneliner import cmdgen
ModuleNotFoundError: No module named 'pysnmp'

Failed to import 'keystoneauth1' ... albeit installed?

I am using python3 via brew on MacOs.
When I do
> python3 -c "import keystoneauth1"
I get:
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'keystoneauth1'
But then:
> pip3 install keystoneauth1
Requirement already satisfied: keystoneauth1 in /usr/local/lib/python3.7/site-packages (3.9.0)
Requirement already satisfied: iso8601>=0.1.11 in /usr/local/lib/python3.7/site-packages (from keystoneauth1) (0.1.12)
Requirement already satisfied: os-service-types>=1.2.0 in /usr/local/lib/python3.7/site-packages (from keystoneauth1) (1.2.0)
Requirement already satisfied: stevedore>=1.20.0 in /usr/local/lib/python3.7/site-packages (from keystoneauth1) (1.28.0)
Requirement already satisfied: pbr!=2.1.0,>=2.0.0 in /usr/local/lib/python3.7/site-packages (from keystoneauth1) (4.1.0)
Requirement already satisfied: six>=1.10.0 in /usr/local/lib/python3.7/site-packages (from keystoneauth1) (1.11.0)
Requirement already satisfied: requests>=2.14.2 in /usr/local/lib/python3.7/site-packages (from keystoneauth1) (2.19.1)
Requirement already satisfied: idna<2.8,>=2.5 in /usr/local/lib/python3.7/site-packages (from requests>=2.14.2->keystoneauth1) (2.7)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.7/site-packages (from requests>=2.14.2->keystoneauth1) (2018.4.16)
Requirement already satisfied: urllib3<1.24,>=1.21.1 in /usr/local/lib/python3.7/site-packages (from requests>=2.14.2->keystoneauth1) (1.23)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/local/lib/python3.7/site-packages (from requests>=2.14.2->keystoneauth1) (3.0.4)
Nothing else shows up there. When I then verify the installation, things look good:
> pip3 show keystoneauth1
Name: keystoneauth1
Version: 3.9.0
Summary: Authentication Library for OpenStack Identity
Home-page: https://docs.openstack.org/keystoneauth/latest/
Author: OpenStack
Author-email: openstack-dev#lists.openstack.org
License: UNKNOWN
Location: /usr/local/lib/python3.7/site-packages
Requires: stevedore, requests, pbr, os-service-types, six, iso8601
Required-by: openstacksdk, keystoneauth
But as shown, already importing that module doesn't work.
For me, the problem manifested itself after upgrading brew python to the lastest version 3.7.6.
I explicitly upgraded brew, and pip3 as well, but no luck.
And sorry for the repeated typos. The module name is really keystoneauth1.
I really don't understand what exactly is going on here.
So this isn't really an answer that explains and solves the issue, but the workaround that worked for me:
First, I force removed python brew uninstall --ignore-dependencies python
Then, I only installed it again brew install python
And afterwards, my scripts (that in the end used that import) work again without any problems?!

Rasa NLU installation issue - Incompatible Version

I am trying to install rasa NLU using 'pip install rasa' command. The installation ends up with the compatibility error.
Kindly some one into the issue and help me out in resolving the version incompatible issue.
Error:
C:\Users\Desktop\RASA NLU>pip install rasa
Requirement already satisfied: h5py in
c:\users\appdata\local\continuum\anaconda3\lib\site-packages (from
keras-applications>=1.0.6->tensorflow~=1.13.0->rasa) (2.9.0)
Requirement already satisfied: asn1crypto>=0.21.0 in
c:\users\appdata\local\continuum\anaconda3\lib\ site-packages (from
cryptography->python-telegram-bot~=11.0->rasa) (0.24.0)
Requirement already satisfied: click>=5.1 in
c:\users\appdata\local\continuum\anaconda3\lib\site-packages (from
flask~=1.0->rasa-sdk~=1.0.0rc4->rasa) (7.0)
Requirement already satisfied: itsdangerous>=0.24 in c
:\users\appdata\local\continuum\anaconda3 \lib\site- packages (from
flask~=1.0->rasa-sdk~=1.0.0rc4->rasa) (1.1.0)
Requirement already satisfied: Jinja2>=2.10.1 in
c:\users\appdata\local\continuum\anaconda3\lib\site-packages (from
flask~=1.0->rasa-sdk~=1.0.0rc4->rasa) (2.10.1)
Requirement already satisfied: pycparser in
c:\users\appdata\local\continuum\anaconda3\lib\site-packages (from
cffi>=1.11.5->gevent~=1.4->rasa) (2.19)
Requirement already satisfied: docutils<0.16,>=0.10 in
c:\users\appdata\local\continuum \anaconda3 \lib\site-packages (from
botocore<1.13.0,>=1.12.146->boto3~=1.9->rasa) (0.14)
Requirement already satisfied: MarkupSafe>=0.23 in
c:\users\appdata\local\continuum\anaconda3\lib\site-packages (from
Jinja2>=2.10.1->flask~=1.0->rasa-sdk~=1.0.0rc4->rasa) (1.1.1)
**ERROR: mxnet 1.3.1 has requirement numpy<1.15.0,>=1.8.2, but you'll have numpy 1.17.4 which is incompatible.
ERROR: mxnet 1.3.1 has requirement requests<2.19.0,>=2.18.4, but
you'll have requests 2.22.0 which is incompatible.
ERROR: rasa-x 0.22.1 has requirement rasa~=1.4.0, but you'll have rasa
1.0.9 which is incompatible.
ERROR: rasa-x 0.22.1 has requirement sanic~=19.6, but you'll have
sanic 19.3.1 which is incompatible.
ERROR: apixu 0.3.0 has requirement requests==2.21, but you'll have
requests 2.22.0 which is incompatible.**
Installing collected packages: requests Found existing installation:
requests 2.21.0
Uninstalling requests-2.21.0:
Successfully uninstalled requests-2.21.0 Successfully installed
requests-2.22.0
First of all please check your python version it's must be > 3.5
Then Please try your installation with --extra-index-url params
For Installation
sudo python3 -m pip install --extra-index-url rasa
For Upgrade to latest version
sudo python3 -m pip install --extra-index-url rasa --upgrade
Still you can comment here for other errors.

import boto3 error on Mac OS

I'm trying to install boto3 on my mac (high sierra 10.13.3) and tried to follow : https://github.com/boto/boto3. I had already installed python 3 using homebrew before, but when I tried to see pip --version, I get error.
So, I did
1) modify .bash_profile to add
alias pip=pip3
2) verify
$ pip --version
pip 9.0.1 from /usr/local/lib/python3.6/site-packages (python 3.6)
3)
$ pip install boto3
Collecting boto3
Downloading boto3-1.5.36-py2.py3-none-any.whl (128kB)
100% |████████████████████████████████| 133kB 474kB/s
Collecting botocore<1.9.0,>=1.8.50 (from boto3)
Downloading botocore-1.8.50-py2.py3-none-any.whl (4.1MB)
100% |████████████████████████████████| 4.1MB 376kB/s
Requirement already satisfied: s3transfer<0.2.0,>=0.1.10 in ./Library/Python/3.6/lib/python/site-packages (from boto3)
Requirement already satisfied: jmespath<1.0.0,>=0.7.1 in ./Library/Python/3.6/lib/python/site-packages (from boto3)
Requirement already satisfied: python-dateutil<3.0.0,>=2.1 in ./Library/Python/3.6/lib/python/site-packages (from botocore<1.9.0,>=1.8.50->boto3)
Requirement already satisfied: docutils>=0.10 in ./Library/Python/3.6/lib/python/site-packages (from botocore<1.9.0,>=1.8.50->boto3)
Requirement already satisfied: six>=1.5 in ./Library/Python/3.6/lib/python/site-packages (from python-dateutil<3.0.0,>=2.1->botocore<1.9.0,>=1.8.50->boto3)
Installing collected packages: botocore, boto3
Found existing installation: botocore 1.8.20
Uninstalling botocore-1.8.20:
Successfully uninstalled botocore-1.8.20
Successfully installed boto3-1.5.36 botocore-1.8.50
4) just to make sure this was fine, I ran
$ pip3 install boto3
Requirement already satisfied: boto3 in /usr/local/lib/python3.6/site-packages
Requirement already satisfied: jmespath<1.0.0,>=0.7.1 in /Users/ond983/Library/Python/3.6/lib/python/site-packages (from boto3)
Requirement already satisfied: s3transfer<0.2.0,>=0.1.10 in /Users/ond983/Library/Python/3.6/lib/python/site-packages (from boto3)
Requirement already satisfied: botocore<1.9.0,>=1.8.50 in /usr/local/lib/python3.6/site-packages (from boto3)
Requirement already satisfied: docutils>=0.10 in /Users/ond983/Library/Python/3.6/lib/python/site-packages (from botocore<1.9.0,>=1.8.50->boto3)
Requirement already satisfied: python-dateutil<3.0.0,>=2.1 in /Users/ond983/Library/Python/3.6/lib/python/site-packages (from botocore<1.9.0,>=1.8.50->boto3)
Requirement already satisfied: six>=1.5 in /Users/ond983/Library/Python/3.6/lib/python/site-packages (from python-dateutil<3.0.0,>=2.1->botocore<1.9.0,>=1.8.50->boto3)
5) but, now when I ran import boto3 in Idle, I get error
import boto3
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import boto3
ModuleNotFoundError: No module named 'boto3'
I even tried to change path in .bash_profile, but it did not work.
Thoughts?
It worked for me to just copy all of packages with "bolo" in the name from the Python 3.7 folder to the Python 2.7 folder:
/usr/local/lib/python3.7/site-packages $ sudo cp -R boto* /Library/Python/2.7/site-packages/.

Python3.5: Import Error - Module already exists

Hello I am trying to send an API request to http via Python's requests package and getting an ImportError while using import requests for python 3.5.2.
I tried to install requests package via pip3.5 install requests that says
Requirement already satisfied: requests in /usr/lib/python3.5/site-packages
Requirement already satisfied: idna<2.6,>=2.5 in /usr/lib/python3.5/site-packages (from requests)
Requirement already satisfied: urllib3<1.23,>=1.21.1 in /usr/lib/python3.5/site-packages (from requests)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/lib/python3.5/site-packages (from requests)
Requirement already satisfied: certifi>=2017.4.17 in /usr/lib/python3.5/site-packages (from requests)
if I list the install packages pip3.5 list I got
appdirs (1.4.3)
bencode (1.0)
better-bencode (0.2.1)
certifi (2017.7.27.1)
chardet (3.0.4)
click (6.7)
Flask (0.12.2)
gevent (1.2.2)
greenlet (0.4.12)
humanfriendly (4.4)
idna (2.5)
itsdangerous (0.24)
Jinja2 (2.9.6)
magneticod (0.6.0)
magneticow (0.6.0)
MarkupSafe (1.0)
Naked (0.1.31)
parse-torrent-name (1.1.1)
pip (9.0.1)
PyYAML (3.12)
requests (2.18.3) <--- Here its already installed
setuptools (33.1.1)
urllib3 (1.22)
uvloop (0.8.0)
Werkzeug (0.12.2)
this is how I am running the python script python3 script.py (interpreting with python3.5)
your help would be appreciated. Thank you!

Categories

Resources