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.
Related
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.
On my mac, pip3 exists in /usr/bin. When I try to install any package using pip3, it is failing. Even simple 'pip3' also failing with below error.
Traceback (most recent call last):
File "/Library/Developer/CommandLineTools/usr/bin/pip3", line 6, in <module>
from pip._internal import main
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/pip/_internal/__init__.py", line 40, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/pip/_internal/cli/autocompletion.py", line 8, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/pip/_internal/cli/main_parser.py", line 11, in <module>
from pip._internal.commands import (
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/pip/_internal/commands/__init__.py", line 6, in <module>
from pip._internal.commands.completion import CompletionCommand
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/pip/_internal/commands/completion.py", line 6, in <module>
from pip._internal.cli.base_command import Command
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/pip/_internal/cli/base_command.py", line 26, in <module>
from pip._internal.index import PackageFinder
ImportError: cannot import name 'PackageFinder' from 'pip._internal.index' (/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/pip/_internal/index/__init__.py)
I tried to remove /usr/bin/pip3. But it is saying operation is not permitted. I am unable to remove pip3. Can any one please let me know how to fix this issue.
Note: I went through some stack overflow questions related to this. Most of the answers suggested to uninstall and install pip3. But I am unable to remove pip3.
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.
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
Was trying to play with Scrapy for the first time. Switched to my python 3.5 environment created by Anaconda and installed scrapy 1.2.0 per scrapy website:
$conda install -c scrapinghub scrapy
Now when I try to do
$scrapy startproject tutorial
I get the following traceback:
Traceback (most recent call last):
File "/Users/bonjuice/anaconda/envs/py35/bin/scrapy", line 7, in <module>
from scrapy.cmdline import execute
File "/Users/bonjuice/anaconda/envs/py35/lib/python3.5/site-packages/scrapy/cmdline.py", line 9, in <module>
from scrapy.crawler import CrawlerProcess
File "/Users/bonjuice/anaconda/envs/py35/lib/python3.5/site-packages/scrapy/crawler.py", line 6, in <module>
from twisted.internet import reactor, defer
File "/Users/bonjuice/anaconda/envs/py35/lib/python3.5/site-packages/twisted/internet/reactor.py", line 38, in <module>
from twisted.internet import default
File "/Users/bonjuice/anaconda/envs/py35/lib/python3.5/site-packages/twisted/internet/default.py", line 56, in <module>
install = _getInstallFunction(platform)
File "/Users/bonjuice/anaconda/envs/py35/lib/python3.5/site-packages/twisted/internet/default.py", line 50, in _getInstallFunction
from twisted.internet.selectreactor import install
File "/Users/bonjuice/anaconda/envs/py35/lib/python3.5/site-packages/twisted/internet/selectreactor.py", line 18, in <module>
from twisted.internet import posixbase
File "/Users/bonjuice/anaconda/envs/py35/lib/python3.5/site-packages/twisted/internet/posixbase.py", line 18, in <module>
from twisted.internet import error, udp, tcp
File "/Users/bonjuice/anaconda/envs/py35/lib/python3.5/site-packages/twisted/internet/tcp.py", line 28, in <module>
from twisted.internet._newtls import (
File "/Users/bonjuice/anaconda/envs/py35/lib/python3.5/site-packages/twisted/internet/_newtls.py", line 21, in <module>
from twisted.protocols.tls import TLSMemoryBIOFactory, TLSMemoryBIOProtocol
File "/Users/bonjuice/anaconda/envs/py35/lib/python3.5/site-packages/twisted/protocols/tls.py", line 41, in <module>
from OpenSSL.SSL import Error, ZeroReturnError, WantReadError
File "/Users/bonjuice/anaconda/envs/py35/lib/python3.5/site-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import rand, crypto, SSL
File "/Users/bonjuice/anaconda/envs/py35/lib/python3.5/site-packages/OpenSSL/rand.py", line 12, in <module>
from OpenSSL._util import (
File "/Users/bonjuice/anaconda/envs/py35/lib/python3.5/site-packages/OpenSSL/_util.py", line 6, in <module>
from cryptography.hazmat.bindings.openssl.binding import Binding
File "/Users/bonjuice/anaconda/envs/py35/lib/python3.5/site-packages/cryptography/hazmat/bindings/openssl/binding.py", line 234, in <module>
Binding.init_static_locks()
File "/Users/bonjuice/anaconda/envs/py35/lib/python3.5/site-packages/cryptography/hazmat/bindings/openssl/binding.py", line 180, in init_static_locks
cls._ensure_ffi_initialized()
File "/Users/bonjuice/anaconda/envs/py35/lib/python3.5/site-packages/cryptography/hazmat/bindings/openssl/binding.py", line 167, in _ensure_ffi_initialized
cls.lib = build_conditional_library(lib, CONDITIONAL_NAMES)
File "/Users/bonjuice/anaconda/envs/py35/lib/python3.5/site-packages/cryptography/hazmat/bindings/openssl/binding.py", line 104, in build_conditional_library
if not getattr(lib, condition):
AttributeError: cffi library '_openssl' has no function, constant or global variable named 'Cryptography_HAS_RSA_OAEP_MD'
I looked around the web but no one seems to be having similar issues, could anyone please point me to the right direction? Much obliged!
It seems to be related to cryptography and openssl.
Official documentation page covers this issue pretty well. Make sure you have all of non-python dependencies.
This is the important bit from the documentation:
sudo apt-get install build-essential libssl-dev libffi-dev python-dev
Also there are specific intructions for conda/anaconda installs:
Because of a bug in conda, attempting to install cryptography out of the box will result in an error. This can be resolved by setting the library path environment variable for your platform.
env LD_LIBRARY_PATH="$HOME/anaconda/lib" pip install cryptography