Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: cannot import name 'opentype' on ubuntu 16, python3.6 #5234

Closed
BHushanRathod opened this issue Apr 25, 2018 · 1 comment
Closed
Assignees
Labels
packaging priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@BHushanRathod
Copy link

Im getting error after upgrading from ubuntu 14 to ubuntu 16. My development server is on ubuntu 14 which has no issue, but now i upgraded my local system with ubuntu 16, and i started getting this error for pip install --upgrade google-cloud-storage package.
Tried pip install --upgrade pyasn1-modules. but same error.

Here are system details and error traceback:

  1. Google Cloud Storage

  2. Distributor ID: Ubuntu
    Description: Ubuntu 16.04.4 LTS
    Release: 16.04
    Codename: xenial

3.Python 3.6.3, pip 10.0.1

  1. $ pip show google-cloud-storage output:
    Name: google-cloud-storage
    Version: 1.8.0
    Summary: Google Cloud Storage API client library
    Home-page: https://github.com/GoogleCloudPlatform/google-cloud-python
    Author: Google LLC
    Author-email: [email protected]
    License: Apache 2.0
    Location: /home/friendcolony/python_workspace/Virtual_EnvPy36/lib/python3.5/site-packages
    Requires: google-api-core, google-cloud-core, google-resumable-media
    Required-by:

pip freeze output

aioredis==1.0.0
asgiref==2.3.0
asn1crypto==0.24.0
async-timeout==2.0.1
attrs==17.4.0
autobahn==18.4.1
Automat==0.6.0
boto3==1.7.7
botocore==1.10.7
cachetools==2.0.1
certifi==2018.4.16
cffi==1.11.5
channels==2.1.1
channels-redis==2.1.1
chardet==3.0.4
click==6.7
constantly==15.1.0
cryptography==2.2.2
daphne==2.1.1
decorator==4.3.0
Django==2.0.4
django-cors-headers==2.2.0
django-fcm==0.1.1
django-filter==1.1.0
django-material==1.2.3
django-simple-history==2.0
django-uuidfield==0.5.0
djangorestframework==3.8.2
djangorestframework-jwt==1.11.0
docutils==0.14
fcm-django==0.2.18
future==0.16.0
geocoder==1.38.1
geographiclib==1.49
geopy==1.13.0
google-api-core==1.1.1
google-auth==1.4.1
google-cloud-core==0.28.1
google-cloud-storage==1.8.0
google-resumable-media==0.3.1
googleapis-common-protos==1.5.3
hiredis==0.2.0
hyperlink==18.0.0
idna==2.6
incremental==17.5.0
ipgetter==0.7
jmespath==0.9.3
msgpack==0.5.6
mysqlclient==1.3.12
Pillow==5.1.0
protobuf==3.5.2.post1
pyasn1==0.4.2
pyasn1-modules==0.2.1
pycparser==2.18
pyfcm==1.4.5
PyJWT==1.6.1
python-dateutil==2.7.2
pytz==2018.4
ratelim==0.1.6
requests==2.18.4
requests-toolbelt==0.8.0
rsa==3.4.2
s3transfer==0.1.13
six==1.11.0
Twisted==17.9.0
txaio==2.10.0
urllib3==1.22
zope.interface==4.5.0
  1. Traceback
[Wed Apr 25 18:43:12.082126 2018] [wsgi:error] [pid 25603] Traceback (most recent call last):
File "/home/friendcolony/python_workspace/Virtual_EnvPy36/lib/python3.6/site-packages/google/auth/crypt/rsa.py", line 20, in <module>
from google.auth.crypt import _cryptography_rsa
File "/home/friendcolony/python_workspace/Virtual_EnvPy36/lib/python3.6/site-packages/google/auth/crypt/_cryptography_rsa.py", line 40, in <module>
raise ImportError(_IMPORT_ERROR_MSG)
ImportError: cryptography>=1.4.0 is required to use cryptography-based RSA implementation.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/friendcolony/python_workspace/Virtual_EnvPy36/lib/python3.6/site-packages/django/core/handlers/exception.py", line 35, in inner
response = get_response(request)
File "/home/friendcolony/python_workspace/Virtual_EnvPy36/lib/python3.6/site-packages/django/core/handlers/base.py", line 113, in _get_response
resolver_match = resolver.resolve(request.path_info)
File "/home/friendcolony/python_workspace/Virtual_EnvPy36/lib/python3.6/site-packages/django/urls/resolvers.py", line 494, in resolve
for pattern in self.url_patterns:
File "/home/friendcolony/python_workspace/Virtual_EnvPy36/lib/python3.6/site-packages/django/utils/functional.py", line 36, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/home/friendcolony/python_workspace/Virtual_EnvPy36/lib/python3.6/site-packages/django/urls/resolvers.py", line 536, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/home/friendcolony/python_workspace/Virtual_EnvPy36/lib/python3.6/site-packages/django/utils/functional.py", line 36, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/home/friendcolony/python_workspace/Virtual_EnvPy36/lib/python3.6/site-packages/django/urls/resolvers.py", line 529, in urlconf_module
return import_module(self.urlconf_name)
File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 665, in exec_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "/home/friendcolony/python_workspace/pycharm_workspace/FriendColony/FriendColony/urls.py", line 21, in <module>
from user_mgmt.views import GetAccessTokenURL, fb_user_login_with_id, otp_verify, reset_password_link, \\
File "/home/friendcolony/python_workspace/pycharm_workspace/FriendColony/user_mgmt/views.py", line 68, in <module>
from google.cloud import storage
File "/home/friendcolony/python_workspace/Virtual_EnvPy36/lib/python3.6/site-packages/google/cloud/storage/__init__.py", line 40, in <module>
from google.cloud.storage.client import Client
File "/home/friendcolony/python_workspace/Virtual_EnvPy36/lib/python3.6/site-packages/google/cloud/storage/client.py", line 22, in <module>
from google.cloud.client import ClientWithProject
File "/home/friendcolony/python_workspace/Virtual_EnvPy36/lib/python3.6/site-packages/google/cloud/client.py", line 27, in <module>
from google.oauth2 import service_account
File "/home/friendcolony/python_workspace/Virtual_EnvPy36/lib/python3.6/site-packages/google/oauth2/service_account.py", line 77, in <module>
from google.auth import _service_account_info
File "/home/friendcolony/python_workspace/Virtual_EnvPy36/lib/python3.6/site-packages/google/auth/_service_account_info.py", line 22, in <module>
[from google.auth import crypt
[File "/home/friendcolony/python_workspace/Virtual_EnvPy36/lib/python3.6/site-packages/google/auth/crypt/__init__.py", line 39, in <module>
[from google.auth.crypt import rsa
[File "/home/friendcolony/python_workspace/Virtual_EnvPy36/lib/python3.6/site-packages/google/auth/crypt/rsa.py", line 27, in <module>
[from google.auth.crypt import _python_rsa
File "/home/friendcolony/python_workspace/Virtual_EnvPy36/lib/python3.6/site-packages/google/auth/crypt/_python_rsa.py", line 26, in <module>
from pyasn1_modules.rfc2459 import Certificate
File "/home/friendcolony/python_workspace/Virtual_EnvPy36/lib/python3.6/site-packages/pyasn1_modules/rfc2459.py", line 20, in <module>
from pyasn1.type import opentype
ImportError: cannot import name 'opentype'

Any Help..?

@BHushanRathod BHushanRathod changed the title ImportError: cannot import name 'opentype' ImportError: cannot import name 'opentype' on ubuntu 14, python3.6 Apr 25, 2018
@BHushanRathod BHushanRathod changed the title ImportError: cannot import name 'opentype' on ubuntu 14, python3.6 ImportError: cannot import name 'opentype' on ubuntu 16, python3.6 Apr 25, 2018
@theacodes theacodes added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. packaging priority: p2 Moderately-important priority. Fix may not be included in next release. labels Apr 25, 2018
@theacodes
Copy link
Contributor

Your version of pyasn1 it too old. I'm not sure why pip install --upgrade pyasn1 isn't fixing it, but that is the root of the problem. pyans1-modules requires pyasn1>=0.4.1,<0.5.0.

It's even weirder that your pip freeze output lists 0.4.2 as the pyans1 version, so I really don't know what's occurring here.

I could not reproduce with Ubuntu 16.04 and the apt-provided Python 3.5. My pip freeze looks like this:

cachetools==2.0.1
certifi==2018.4.16
chardet==3.0.4
google-api-core==1.1.1
google-auth==1.4.1
google-cloud-core==0.28.1
google-cloud-storage==1.8.0
google-resumable-media==0.3.1
googleapis-common-protos==1.5.3
idna==2.6
pkg-resources==0.0.0
protobuf==3.5.2.post1
pyasn1==0.4.2
pyasn1-modules==0.2.1
pytz==2018.4
requests==2.18.4
rsa==3.4.2
six==1.11.0
urllib3==1.22

I'm going to go ahead and close this, but I'm happy to keep discussing and working through this with you.

Josh-Joseph added a commit to mit-quest/necstlab-damage-segmentation that referenced this issue Feb 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
packaging priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

2 participants