ModuleNotFoundError: No module named 'scipy.sparse.base' - python-3.x

I'm trying to run from sklearn import preprocessing, but it raise an error:
Traceback (most recent call last):
File "<ipython-input-6-d27a4e3c0526>", line 1, in <module>
from sklearn import preprocessing
File "/Users/x/anaconda3/lib/python3.6/site-packages/sklearn/__init__.py", line 82, in <module>
from .base import clone
File "/Users/x/anaconda3/lib/python3.6/site-packages/sklearn/base.py", line 17, in <module>
from .utils import _IS_32BIT
File "/Users/x/anaconda3/lib/python3.6/site-packages/sklearn/utils/__init__.py", line 20, in <module>
from scipy.sparse import issparse
File "/Users/x/.local/lib/python3.6/site-packages/scipy/sparse/__init__.py", line 227, in <module>
from .base import *
ModuleNotFoundError: No module named 'scipy.sparse.base'
How could I deal with it?
The version of scipy is 1.5.4.

Using pip3 install --upgrade --user scipy solved the problem for me.

Related

gspread is not imported when running python3 script

Python: Python 3.4.3
OS: Ubuntu 14.04.6 LTS
Hello, I am getting the following error when I try to run my script under Ubuntu. Under Windows, the gspread module was imported without problems. Can you suggest what could be the problem?
Imported modules:
#!/usr/bin/python3
from simplejson import JSONDecodeError
import gspread
import os
Error while running the script:
Traceback (most recent call last):
File "./poverka_python.py", line 5, in <module>
import gspread
File "/usr/local/lib/python3.4/dist-packages/gspread/__init__.py", line 16, in <module>
from .auth import (
File "/usr/local/lib/python3.4/dist-packages/gspread/auth.py", line 16, in <module>
from google_auth_oauthlib.flow import InstalledAppFlow
File "/usr/local/lib/python3.4/dist-packages/google_auth_oauthlib/__init__.py", line 21, in <module>
from .interactive import get_user_credentials
File "/usr/local/lib/python3.4/dist-packages/google_auth_oauthlib/interactive.py", line 27, in <module>
import google_auth_oauthlib.flow
File "/usr/local/lib/python3.4/dist-packages/google_auth_oauthlib/flow.py", line 66, in <module>
import google.auth.transport.requests
File "/usr/local/lib/python3.4/dist-packages/google/auth/transport/requests.py", line 26, in <module>
import requests
File "/usr/local/lib/python3.4/dist-packages/requests/__init__.py", line 48, in <module>
from charset_normalizer import __version__ as charset_normalizer_version
File "/usr/local/lib/python3.4/dist-packages/charset_normalizer/__init__.py", line 24, in <module>
from .api import from_bytes, from_fp, from_path, normalize
File "/usr/local/lib/python3.4/dist-packages/charset_normalizer/api.py", line 71
previous_logger_level: int = logger.level
if you enter "pip3 install gspread"
Requirement already satisfied (use --upgrade to upgrade): gspread in /usr/local/lib/python3.4/dist-packages
Cleaning up...
I have tried installing and reinstalling gspread. Also under Windows everything starts without problems.

./google-cloud-sdk/install.sh triggers error while installing GCloud SDK in ubuntu

Trying to install GCloud SDK in Ubuntu 18.04.
I have python 3.6 installed in the system.
Error says :
Welcome to the Google Cloud CLI!
Traceback (most recent call last):
File "/home/anm/Durgendra Workspace/WebDev/sdk/./google-cloud-sdk/bin/bootstrapping/install.py", line 12, in <module>
import bootstrapping
File "/home/anm/Durgendra Workspace/WebDev/sdk/google-cloud-sdk/bin/bootstrapping/bootstrapping.py", line 32, in <module>
import setup # pylint:disable=g-import-not-at-top
File "/home/anm/Durgendra Workspace/WebDev/sdk/google-cloud-sdk/bin/bootstrapping/setup.py", line 57, in <module>
from googlecloudsdk.core.util import platforms
File "/home/anm/Durgendra Workspace/WebDev/sdk/google-cloud-sdk/lib/googlecloudsdk/__init__.py", line 23, in <module>
from googlecloudsdk.core.util import importing
File "/home/anm/Durgendra Workspace/WebDev/sdk/google-cloud-sdk/lib/googlecloudsdk/core/util/importing.py", line 23, in <module>
import imp
File "/home/anm/lib/python3.6/imp.py", line 23, in <module>
from importlib import util
File "/home/anm/lib/python3.6/importlib/util.py", line 13, in <module>
from contextlib import contextmanager
ModuleNotFoundError: No module named 'contextlib'
To solve this I tried to install contextlib using
pip install contextlib2
But this is of no use.

Problem With Tensorflow ,Tried with all versions ,current using Tensorflow version 2.00a0 ,python 3.6 Any idea Regarding this?

Tensorflow version 2.00a0 ,Python 3.6,IDE PyCharm
installed tensorflow framework using
python -m pip install tensorflow --trusted-host files.pythonhosted.org --trusted-host pypi.org --trusted-host pypi.python.org
Upgraded using,
pip install tensorflow==2.0.0-alpha0
This is the error.
Traceback (most recent call last):
File "C:/Users/Athish/PycharmProjects/new1/Dashboard.py", line 36, in <module>
from tensorflow.keras.models import load_model
File "C:\Users\Athish\PycharmProjects\new1\venv\lib\site-packages\tensorflow\__init__.py", line 27, in <module>
from tensorflow._api.v2 import audio
File "C:\Users\Athish\PycharmProjects\new1\venv\lib\site-packages\tensorflow\_api\v2\audio\__init__.py", line 8, in <module>
from tensorflow.python.ops.gen_audio_ops import decode_wav
File "C:\Users\Athish\PycharmProjects\new1\venv\lib\site-packages\tensorflow\python\__init__.py", line 52, in <module>
from tensorflow.core.framework.graph_pb2 import *
File "C:\Users\Athish\PycharmProjects\new1\venv\lib\site-
packages\tensorflow\core\framework\graph_pb2.py", line 6, in <module>
from google.protobuf import descriptor as _descriptor
File "c:\users\athish\pycharmprojects\new1\venv\lib\site-packages\google\protobuf\descriptor.py", line 47, in <module>
from google.protobuf.pyext import _message
ImportError: DLL load failed: The specified procedure could not be found.

scipy.stats attribute not found

I tried to import scipy.stats as ss but it keeps showing me an import error:
Traceback (most recent call last):
File "E:\My Python Files\KNN_Classification.py", line 4, in <module>
import scipy.stats
File "D:\Python3.6\lib\site-packages\scipy\stats\__init__.py", line 343, in <module>
from .stats import *
File "D:\Python3.6\lib\site-packages\scipy\stats\stats.py", line 169, in <module>
import scipy.special as special
File "D:\Python3.6\lib\site-packages\scipy\special\__init__.py", line 640, in <module>
from ._ufuncs import *
ImportError: DLL load failed: The specified module could not be found.
What should I do?
Most likely a wrong installation. You should remove the build directory as well as the installed scipy in site-packages, and then reinstall scipy.

Python cannot import name 'NUMPY_MKL'

I am trying to run a wavenet implementation (which uses tensorflow + librosa). However, I keep running into the error "cannot import name 'NUMPY_MKL'".
I have already installed tensorflow, numpy+mk1, scipy and librosa. Tensorflow itself is loading fine, but error is triggered when I run the wavenet implementation which uses librosa.
My spec/details:
Python 3.5.2
Numpy+MK1 (numpy-1.13.1+mkl-cp35-cp35m-win_amd64.whl)
Scipy (scipy-0.19.1-cp35-cp35m-win_amd64.whl)
Windows 10 x64
Nvidia CUDA v8.0 (cudnn 5.1)
Hope you can help. Full error log below:
Traceback (most recent call last):
File "train.py", line 20, in <module>
from wavenet import WaveNetModel, AudioReader, optimizer_factory
File "D:\musicAI\wavenet\__init__.py", line 2, in <module>
from .audio_reader import AudioReader
File "D:\musicAI\wavenet\audio_reader.py", line 7, in <module>
import librosa
File "C:\Python35\lib\site-packages\librosa\__init__.py", line 12, in <module>
from . import core
File "C:\Python35\lib\site-packages\librosa\core\__init__.py", line 108, in <module>
from .time_frequency import * # pylint: disable=wildcard-import
File "C:\Python35\lib\site-packages\librosa\core\time_frequency.py", line 10, in <module>
from ..util.exceptions import ParameterError
File "C:\Python35\lib\site-packages\librosa\util\__init__.py", line 67, in <module>
from .utils import * # pylint: disable=wildcard-import
File "C:\Python35\lib\site-packages\librosa\util\utils.py", line 5, in <module>
import scipy.ndimage
File "C:\Python35\lib\site-packages\scipy\__init__.py", line 61, in <module>
from numpy._distributor_init import NUMPY_MKL # requires numpy+mkl
ImportError: cannot import name 'NUMPY_MKL'
Managed to fixed this by doing a complete uninstall of numpy+mk1, then installing it again.
I was previously doing:
pip install --ignore-install path\numpy.whl
Do this instead to get it working:
pip uninstall numpy # this removes the existing copy
pip install path\numpy.whl # this install the numpy+mk1 from local .whl file

Resources