Some old packages need deprecated scipy.weave package, like pydelay.
Installing weave from pip does not work for them.
What is the solution?
Edit:
In [1]: import pydelay
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-b743be9b35c7> in <module>()
----> 1 import pydelay
/usr/local/lib/python2.7/dist-packages/pydelay/__init__.py in <module>()
7 Last update: 23.10.2009
8 """
----> 9 from _dde23 import dde23
10 #from constantStepper import dde3
11 __all__ = ['dde23', 'gen_disconts']
/usr/local/lib/python2.7/dist-packages/pydelay/_dde23.py in <module>()
30
31 import numpy as np
---> 32 from scipy import weave
33 from scipy.interpolate import splrep, splev, spalde
34 import math
ImportError: cannot import name weave
Here is mentioned that :
Weave is the stand-alone version of the deprecated Scipy submodule scipy.weave.
Solution:
I removed the package, replaced the scipy.weave by weave in files and reinstalled by setup.py file. that's all.
Related
I'm unable to install stackstac on Google Colab. This is reproducible with the code below.
!pip install stackstac
import stackstac
outputs:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-c01f370957f7> in <module>()
1 get_ipython().system('pip install stackstac')
----> 2 import stackstac
1 frames
/usr/local/lib/python3.7/dist-packages/stackstac/rio_reader.py in <module>()
5 import threading
6 import weakref
----> 7 from typing import TYPE_CHECKING, Optional, Protocol, Tuple, Type, Union
8
9 import numpy as np
ImportError: cannot import name 'Protocol' from 'typing' (/usr/lib/python3.7/typing.py)
---------------------------------------------------------------------------
Same issue on a local instance how ever that solution doesn't translate.
Protocol was introduced to typing as of Python 3.8, as can be seen in the docs. You appear to be running Python 3.7, based on your file paths - upgrade to use Python 3.8 or later if you can.
I'm facing an issue which seems to occur very often but the solutions I found so far did not helped me. When I try to do from top2vec import Top2Vec I get the following error:
ValueError Traceback (most recent call last)
<ipython-input-14-f6d7059c0d66> in <module>
----> 1 from top2vec import Top2Vec
2 model = Top2Vec(documents=data, speed="learn", workers=8)
~/env_env/lib/python3.7/site-packages/top2vec/__init__.py in <module>
----> 1 from top2vec.Top2Vec import Top2Vec
2
3 __version__ = '1.0.26'
~/env_env/lib/python3.7/site-packages/top2vec/Top2Vec.py in <module>
9 from gensim.parsing.preprocessing import strip_tags
10 import umap
---> 11 import hdbscan
12 from wordcloud import WordCloud
13 import matplotlib.pyplot as plt
~/env_env/lib/python3.7/site-packages/hdbscan/__init__.py in <module>
----> 1 from .hdbscan_ import HDBSCAN, hdbscan
2 from .robust_single_linkage_ import RobustSingleLinkage, robust_single_linkage
3 from .validity import validity_index
4 from .prediction import (approximate_predict,
5 membership_vector,
~/env_env/lib/python3.7/site-packages/hdbscan/hdbscan_.py in <module>
19 from scipy.sparse import csgraph
20
---> 21 from ._hdbscan_linkage import (single_linkage,
22 mst_linkage_core,
23 mst_linkage_core_vector,
hdbscan/_hdbscan_linkage.pyx in init hdbscan._hdbscan_linkage()
ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObject
When I try to upgrade to numpy==1.20.0 like other solutions suggest than I get in trouble with other packages I need (as displayed in the ERROR warnings below)
ERROR: transformers 4.9.1 has requirement huggingface-hub==0.0.12, but you'll have huggingface-hub 0.0.15 which is incompatible.
ERROR: flair 0.8.0.post1 has requirement numpy<1.20.0, but you'll have numpy 1.20.0 which is incompatible.de here
Does anyone has an idea how to work around on this or was facing the similar issue? I would appreciate every kind of hint!!! Thanks in advance!
I have faced the same issue. I Just installed top2vec==1.0.20 this version of Top2Vec using pip, without upgrading Numpy, and also it required joblib library too.
So install both.
I am having some trouble trying to import geopandas in my Mac. I installed it by the conda command:
conda install -c conda-forge geopandas
After I try to import by I get the following error:
ImportError Traceback (most recent call last)
<ipython-input-2-e508418be6dd> in <module>()
1 import pandas as pd
----> 2 import geopandas as gpd
3 get_ipython().magic('matplotlib inline')
/anaconda/lib/python3.6/site-packages/geopandas/__init__.py in <module>()
2 from geopandas.geodataframe import GeoDataFrame
3
----> 4 from geopandas.io.file import read_file
5 from geopandas.io.sql import read_postgis
6 from geopandas.tools import sjoin
/anaconda/lib/python3.6/site-packages/geopandas/io/file.py in <module>()
1 import os
2
----> 3 import fiona
4 import numpy as np
5
/anaconda/lib/python3.6/site-packages/fiona/__init__.py in <module>()
67 from six import string_types
68
---> 69 from fiona.collection import Collection, BytesCollection, vsi_path
70 from fiona._drivers import driver_count, GDALEnv
71 from fiona.drvsupport import supported_drivers
/anaconda/lib/python3.6/site-packages/fiona/collection.py in <module>()
7
8 from fiona import compat
----> 9 from fiona.ogrext import Iterator, ItemsIterator, KeysIterator
10 from fiona.ogrext import Session, WritingSession
11 from fiona.ogrext import (
ImportError: dlopen(/anaconda/lib/python3.6/site-packages/fiona/ogrext.cpython-36m-darwin.so, 2): Library not loaded: #rpath/libxerces-c-3.1.dylib
Referenced from: /anaconda/lib/libgdal.20.dylib
Reason: image not found
I tried updating my anaconda by running:
conda update conda
Got the same error, so I tried uninstalling with conda and installing with pip. Got the same error.
Then I tried to forge fiona with conda,then installing with pip but it got me nowhere, and now I'm stuck. Any ideas?
I think could have been a problem with the conda-forge feedstock for fiona:
https://github.com/conda-forge/fiona-feedstock/issues/62
I had the same problem a few days ago but it seems to have been resolved now. Have you tried again?
After successfully installing the Geopandas conda package from the conda-forge as follows:
conda install -c conda-forge geopandas
When I try to import it in IPython (Jupyter notebook), using:
import geopandas as gpd
I consistently receive the following error, despite having all the dependencies (numpy, pandas, shapely, fiona, six, pyproj) installed and up-to-date:
---------------------------------------------------------------------
------
ImportError Traceback (most recent call
last)
<ipython-input-1-13760ce748ee> in <module>()
4 import matplotlib.mlab as mlab
5
----> 6 import geopandas as gpd
7 import seaborn as sns
8 from sklearn import preprocessing
//anaconda/lib/python2.7/site-packages/geopandas/__init__.py in <module>()
----> 1 from geopandas.geoseries import GeoSeries
2 from geopandas.geodataframe import GeoDataFrame
3
4 from geopandas.io.file import read_file
5 from geopandas.io.sql import read_postgis
//anaconda/lib/python2.7/site-packages/geopandas/geoseries.py in <module>()
6 from pandas import Series, DataFrame
7 from pandas.core.indexing import _NDFrameIndexer
----> 8 from pandas.util.decorators import cache_readonly
9 import pyproj
10 from shapely.geometry import box, shape, Polygon, Point
ImportError: No module named decorators
Any suggestions on what might be causing the error?
To make the comment of Jeff stand out more, this was fixed in pandas 0.20.1.
So normally, if you now install the latest pandas version (not 0.20.0), you should not get this error.
I am using Enthought Canopy and recently upgraded both Scipy and numpy to the following:
scipy: 0.13 build 2
numpy: 1.8 build 1
When I attempt:
from scipy import stats
I receive the following error:
NameError Traceback (most recent call last)
<ipython-input-123-9d55e67ee92d> in <module>()
----> 1 from scipy import stats
C:\Users\M\AppData\Local\Enthought\Canopy\User\lib\site- packages\scipy\__init__.py in <module>()
75 # Import numpy symbols to scipy name space
76 import numpy as _num
---> 77 from numpy import oldnumeric
78 from numpy import *
79 from numpy.random import rand, randn
C:\Users\M\AppData\Local\Enthought\Canopy\User\lib\site-packages\numpy\oldnumeric\__init__.py in <module>()
9
10 _msg = "The oldnumeric module will be dropped in Numpy 1.9"
---> 11 warnings.warn(_msg, ModuleDeprecationWarning)
12
13
NameError: name 'ModuleDeprecationWarning' is not defined
Not sure what has changed in the modules or if I need to import a different way.
Once you have imported numpy into the kernel, as is automatically done in ipython pylab mode which is enabled by default in Canopy, the kernel must be restarted if you want to import a new version. (No need to fully restart Canopy, just the kernel (see Run menu).