Naveen Naveen - 1 month ago 6x
Python Question

'EntryPoint' object has no attribute 'resolve' when using Google Compute Engine

I have an issue related to Cryptography package in Python. Can you please help in resolving these, if possible ? (tried a lot, but couldnt figure out the exact solution)

The python code which initiates this error:

print("Salt: %s" % salt)
server_key = pyelliptic.ECC(curve="prime256v1") # ----->> Line2
print("Server_key: %s" % server_key) # ----->> Line3
server_key_id = base64.urlsafe_b64encode(server_key.get_pubkey()[1:])

http_ece.keys[server_key_id] = server_key
http_ece.labels[server_key_id] = "P-256"
encrypted = http_ece.encrypt(data, salt=salt, keyid=server_key_id,
dh=self.receiver_key, authSecret=self.auth_key) # ----->> Line8

Value of "Salt" is getting displayed in 100% of the cases.

If Line3 gets executed successfully, I see the the following EntryPoint Error because of http_ece.encrypt() call (Line8):

AttributeError("'EntryPoint' object has no attribute 'resolve'",)

(Ref. File Link: )



On Running the command:
sudo pip freeze --all |grep setuptools
, I get:

Please let me know if any more detail is required.

This problem seems to be basically due to some Old/Incompatible packages(related to PyElliptic, Cryptography, PyOpenSSL and/or setuptools) installed on the VM. For Reference:

Can someone please suggest a good solution to resolve this issue completely ?



Ran Following Commands from the project path /opt/projects/myproject-google/myproject and it resolved the Attribute EntryPoint Error Issue:

(Assuming project virtual env path as: /opt/projects/myproject-google)


export PYTHONPATH=      # [Blank]
sudo pip install --upgrade virtualenv setuptools
sudo rm -rf ../venv
sudo virtualenv ../venv
source ../venv/bin/activate
sudo pip install --upgrade -r requirements.txt

Running the above commands upgraded the virtual environment & the setuptools version inside the virtual Env. located at path: /opt/projects/myproject-google/venv/lib/python2.7/site-packages. To test if setuptools have upgraded successfully, try some of these commands:

  1. Command: sudo virtualenv --version Output: 15.0.3
  2. Command: echo $PYTHONPATH Output: [blank]
  3. Command: python -c 'import pkg_resources; print(pkg_resources.__file__)' Output: ~/.local/lib/python2.7/site-packages/pkg_resources/__init__.pyc
  4. Command: python -c 'import sys; print(sys.path)' Output: ['', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '~/.local/lib/python2.7/site-packages', '/usr/local/lib/python2.7/dist-packages', '/opt/projects/myproject-google/myproject', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/PILcompat']
  5. Command: ls /opt/projects/myproject-google/venv/lib/python2.7/site-packages Output: pip pkg_resources setuptools-27.2.0.dist-info wheel-0.30.0a0.dist-info easy_install.pyc pip-8.1.2.dist-info setuptools wheel
  6. Command: python -c 'from cryptography.hazmat.backends import default_backend; print(default_backend())' Output: <cryptography.hazmat.backends.multibackend.MultiBackend object at 0x7ff83a838d50>
  7. Command /opt/projects/myproject-google/venv/bin/python -c 'from cryptography.hazmat.backends import default_backend; print(default_backend())' Output Traceback (most recent call last): File "<string>", line 1, in <module> ImportError: No module named cryptography.hazmat.backends
  8. Command: /opt/projects/myproject-google/venv/bin/python -c "import pkg_resources; print(pkg_resources.__file__)" Output: /opt/projects/myproject-google/venv/local/lib/python2.7/site-packages/pkg_resources/__init__.pyc

Ref Link:

These Steps resolved the Attribute EntryPoint Issue completely with an updated version of cryptography package & the setuptools.

Update As on 15 September 2016, The Cryptography Team has again added the workaround for supporting old packages too. (Ref. Link: )