ImportError: cannot import name 'unique_everseen' - python

I'm trying to import quandl in to spyder (python 3.6) and I get the issues as seen in the title above. Could it be a fault with the more-itertools package, as I have not seen a file within the more_itertools folder which matches unique_everseen
File "C:\Program Files\Anaconda3\lib\site-
packages\quandl\model\merged_dataset.py", line 1, in <module>
from more_itertools import unique_everseen

I would recommend using pip to install the package since more_itertools is not yet an official package on conda. Activate the desired conda environment and install:
> activate <environment name>
> pip install more_itertools
See installation instructions here

Related

pip install geopandas on windows

I am relatively new to python and trying to install geopandas on python 3.7 using pip. For separate reasons, I would like to avoid using the anaconda distribution. Following this post, I was able to successfully install geopandas by first installing the dependencies manually. The problem is that now I run into a problem when I try to import geopandas:
import geopandas
The subsequent error message is:
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\geopandas\__init__.py", line 5, in <module>
from geopandas.io.file import read_file
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\geopandas\io\file.py", line 4, in <module>
import fiona
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\fiona\__init__.py", line 87, in <module>
from fiona.collection import BytesCollection, Collection
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\fiona\collection.py", line 9, in <module>
from fiona.ogrext import Iterator, ItemsIterator, KeysIterator
ImportError: DLL load failed: The specified module could not be found.
Any advice would be greatly appreciated
My case is similar to yours. And here is how I got mine setup:
Platform: Windows 10, 64-bit Python Version: Python 3.7
Dependencies (whl files needed):
GDAL‑3.0.4‑cp37‑cp37m‑win_amd64.whl
Fiona‑1.8.13‑cp37‑cp37m‑win_amd64.whl
pyproj‑2.6.0‑cp37‑cp37m‑win_amd64.whl
Rtree‑0.9.4‑cp37‑cp37m‑win_amd64.whl
Steps:
Download the files that match the platform and Python version from
https://www.lfd.uci.edu/~gohlke/pythonlibs/
Install packages (stick with the order)
a) C:\Users...\Python37\Scripts>pip3.7 install C:...\GDAL‑3.0.4‑cp37‑cp37m‑win_amd64.whl
b) C:\Users...\Python37\Scripts>pip3.7 install C:...\Fiona‑1.8.13‑cp37‑cp37m‑win_amd64.whl
c) C:\Users...\Python37\Scripts>pip3.7 install C:...\pyproj‑2.6.0‑cp37‑cp37m‑win_amd64.whl
d) C:\Users...\Python37\Scripts>pip3.7 install C:...\Rtree‑0.9.4‑cp37‑cp37m‑win_amd64.whl
Given no errros, now it's good to go:
C:\Users...\Python37\Scripts>pip3.7.exe install geopandas
Test it using IDEL 3.7.4
import geopandas as pdg
(It works!)
This works for me and I hope this is also helpful for you.
I had trouble installing geopandas on (win-64, Spyder3.8, Python3.8.3)
Use this expression to install geopandas in anaconda prompt:
conda install -c conda-forge/label/cf202003 geos
(do not use this website: https://geopandas.org/install.html)
(do not use this expression: conda install --channel conda-forge geopandas)
The simplest method to install geopandas is:
conda install geopandas
In order to update geopandas to latest version use the following command after installation by conda:
pip install geopandas --upgrade
There are other installation methods also explained in Geopandas official website.
Conda is really powerful when it comes to installation as it will install the dependencies needed by the package. However, if you would like to install dependencies earlier than use the following command:
conda install pandas fiona shapely pyproj rtree descartes
Note that if you have installed the dependencies using above command then you can also use pip to install geopandas but before installing via pip dependencies are required to be installed. In order to read more about dependencies, please follow the official guide. To install using pip use the following command:
pip install geopandas

Python 3 ImportError: cannot import name 'model selection' OS X 10.11.3, Anaconda

Python 3.5.1 |Anaconda 4.0.0 (x86_64)on OS X 10.11.3
>>> from sklearn import pipeline, model_selection
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name 'model_selection'
tried to:
upgrade six, sk-learn,
sudo pip uninstall python-dateutil
sudo pip install python-dateutil==2.2
pip2 install six -U
pip install --ignore-installed six
pip install --ignore-installed ipython
even reinstall the anaconda...
Did NOT fixed.
Thanks for help
_________Updata________
I have checked that my six version is the newest one (version = "1.10.0")
import sklearn
sklearn.version
'0.17.1'
I found that there is no folder name "model_selection" in sklearn folder. But there is this folder in https://github.com/scikit-learn/scikit-learn/tree/3078d7d611329c46777d4004a1185a3626558efe/sklearn.
After install the dev version by
$ pip install git+git://github.com/scikit-learn/scikit-learn.git
Successfully installed scikit-learn-0.18.dev0
And then run a script which runs successfully in 0.17.1, it shows error:
from .pairwise_fast import _chi2_kernel_fast, _sparse_manhattan
ImportError: dlopen(/Users/Username/anaconda3/lib/python3.5/site-packages/sklearn/metrics/pairwise_fast.cpython-35m-darwin.so, 2): Library not loaded: libmkl_intel_lp64.dylib
Referenced from: /Users/Username/anaconda3/lib/python3.5/site-packages/sklearn/metrics/pairwise_fast.cpython-35m-darwin.so
Reason: image not found
What version of scikit-learn are you using? It looks like the latest, when I install for Python 3.5, is 0.17.1. Checking in the console:
import sklearn
sklearn.__version__
'0.17.1'
According to the documentation for this version that "model_selection" package doesn't exist. It does exist in the dev version. This should be why it is complaining.

scikit-bio not working after installation

I have installed scikit-bio on my mac and when I run python -m skbio.test, I get the following error:
File "/macqiime/anaconda/lib/python2.7/site-packages/skbio/io/tests/test_util.py", line 17, in <module>
import httpretty
ImportError: No module named httpretty.
Could this be based on my PATH?
-macqiime is in the directory Users.
Edit: Changed my answer to use conda instead of pip
Try executing:
conda install -c https://conda.anaconda.org/hargup httpretty

Installing iPython: "ImportError cannot import name path"?

I'm trying to install IPython. I have run pip install ipython[notebook] without any errors, but now I get this:
$ ipython notebook
Traceback (most recent call last):
File "/Users/me/.virtualenvs/.venv/bin/ipython", line 7, in <module>
from IPython import start_ipython
File "/Users/me/.virtualenvs/.venv/lib/python2.7/site-packages/IPython/__init__.py", line 48, in <module>
from .terminal.embed import embed
File "/Users/me/.virtualenvs/.venv/lib/python2.7/site-packages/IPython/terminal/embed.py", line 16, in <module>
from IPython.core.interactiveshell import DummyMod
File "/Users/me/.virtualenvs/.venv/lib/python2.7/site-packages/IPython/core/interactiveshell.py", line 31, in <module>
from pickleshare import PickleShareDB
File "/Users/me/.virtualenvs/.venv/lib/python2.7/site-packages/pickleshare.py", line 41, in <module>
from path import path as Path
ImportError: cannot import name path
I have the same error if I try to run import pickleshare at a Python console, or from path import path.
What can I do to fix this?
Looks like this is a known issue, caused by a change in the path.py package. Reverting to an older version of path.py solves this :
sudo pip3 install -I path.py==7.7.1
It appears that pickleshare is in package IPython.utils. Try tying
from IPython.utils.pickleshare import PickleShareDB
Similarly, path is in IPython.external. Try typing
from IPython.external.path import path as Path
In either case, I would check if following files exist.
"/Users/me/.virtualenvs/.venv/lib/python2.7/site-packages/IPython/utils/pickleshare.py"
"/Users/me/.virtualenvs/.venv/lib/python2.7/site-packages/IPython/external/path/_path.py"
All this points to the fact that probably your IPython/notebook version is old. A couple of solutions would be
1) Try editing files in site-packages and changing import lines to
from IPython.external.path import path as Path
from IPython.utils.pickleshare import PickleShareDB
But that's kind of risky, who knows what else might fail.
Otherwise, try upgrading ipython/notebook
pip install ipython --upgrade
pip install "ipython[notebook]" --upgrade
I had similar issues and rolling back to an earlier version of path.py did not not help. I uninstalled the package and then IPython Notebook worked.
pip uninstall -y path.py
import Path (not path - It should be "UPPER CASE" P and not "lower case" p)
I received this error while trying to import matplotlib on Windows 10. My problem was that matplotlib needed an update. I just ran the following code:
python -m pip install matplotlib
or:
conda install matplotlib
My guess is that this can be applied to IPython.
This works for me, use :
from pathlib import Path

Python and importing

I installed python 3.4.3 and NLTK-3.0.4. When I import nltk in python, the below error appeared :
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import nltk
ImportError: No module named 'nltk'
How can I solve this?
I just extract nltk.rar and then copy the folder to the below folder:
C/python34/lib
Note: before copying the folder, you should rename the name of the folder and just remove the numbers.
Before copying = nltk 3.4.3
After renaming = nltk
Following are the instructions from the nltk website.So what's the os you are using
Mac/Unix
Install NLTK: run sudo pip install -U nltk
Install Numpy (optional): run sudo pip install -U numpy
Test installation: run python then type import nltk
For older versions of Python it might be necessary to install setuptools (see http://pypi.python.org/pypi/setuptools) and to install pip (sudo easy_install pip).
Windows
These instructions assume that you do not already have Python installed on your machine.
Install python 3.4 first
Install NLTK: http://pypi.python.org/pypi/nltk
Test installation: Start>Python34, then type import nltk

Categories