'EntryPoint' object has no attribute 'resolve' when using Google Compute Engine
<p>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)</p>

<p>The python code which initiates this error: </p>

<pre><code>print("Salt: %s" % salt)
server_key = pyelliptic.ECC(curve="prime256v1")  # -----&gt;&gt; Line2
print("Server_key: %s" % server_key)   # -----&gt;&gt; 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)  # -----&gt;&gt; Line8
</code></pre>

<p>Value of "Salt" is getting displayed in 100% of the cases. </p>

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

<pre><code>AttributeError("'EntryPoint' object has no attribute 'resolve'",)
</code></pre>

<p>(Ref. File Link: <a href="https://github.com/martinthomson/encrypted-content-encoding/blob/master/python/http_ece/__init__.py#L128">https://github.com/martinthomson/encrypted-content-encoding/blob/master/python/http_ece/init.py#L128</a> )</p>

<p>Requirements.txt(partial):</p>

<pre><code>cryptography==1.5
pyelliptic==1.5.7
pyOpenSSL==16.1.0
</code></pre>

<p>On Running the command: <code>sudo pip freeze --all |grep setuptools</code>, I get:
<code>setuptools==27.1.2</code></p>

<p>Please let me know if any more detail is required.</p>

<p>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: <a href="https://github.com/pyca/cryptography/issues/3149">https://github.com/pyca/cryptography/issues/3149</a></p>

<p>Can someone please suggest a good solution to resolve this issue completely ?</p>

<p>Thanks,</p>

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

<p>(Assuming project virtual env path as: /opt/projects/myproject-google/venv)</p>

<p>Command: (from path: /opt/projects/myproject-google/myproject)</p>

<pre><code>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
deactivate
</code></pre>

<p>Running the above commands upgraded the  virtual environment &amp; 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:</p>

<ol>
<li><strong>Command</strong>: <code>sudo virtualenv --version</code>
<strong>Output</strong>: <code>15.0.3</code></li>
<li><strong>Command</strong>: <code>echo $PYTHONPATH</code>
<strong>Output</strong>: [blank]</li>
<li><strong>Command</strong>: <code>python -c 'import pkg_resources; print(pkg_resources.__file__)'</code>
<strong>Output</strong>: <code>~/.local/lib/python2.7/site-packages/pkg_resources/__init__.pyc</code></li>
<li><strong>Command</strong>: <code>python -c 'import sys; print(sys.path)'</code>
<strong>Output</strong>: <code>['', '/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']</code></li>
<li><strong>Command</strong>: <code>ls  /opt/projects/myproject-google/venv/lib/python2.7/site-packages</code>
<strong>Output</strong>:
<code>easy_install.py   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</code></li>
<li><strong>Command</strong>: <code>python -c 'from cryptography.hazmat.backends import default_backend; print(default_backend())'</code>
<strong>Output</strong>: <code>&lt;cryptography.hazmat.backends.multibackend.MultiBackend object at 0x7ff83a838d50&gt;</code></li>
<li><strong>Command</strong> <code>/opt/projects/myproject-google/venv/bin/python -c 'from cryptography.hazmat.backends import default_backend; print(default_backend())'</code>
<strong>Output</strong>
<code>
Traceback (most recent call last):
File "&lt;string&gt;", line 1, in &lt;module&gt;
ImportError: No module named cryptography.hazmat.backends
</code></li>
<li><strong>Command</strong>: <code>/opt/projects/myproject-google/venv/bin/python -c "import pkg_resources; print(pkg_resources.__file__)"</code>
<strong>Output</strong>: <code>/opt/projects/myproject-google/venv/local/lib/python2.7/site-packages/pkg_resources/__init__.pyc</code></li>
</ol>

<p>Ref Link: <a href="https://github.com/pyca/cryptography/issues/3149" rel="nofollow">https://github.com/pyca/cryptography/issues/3149</a></p>

<p>These Steps resolved the Attribute EntryPoint Issue completely with an updated version of cryptography package &amp; the setuptools.</p>

<p><strong>Update</strong> As on 15 September 2016, The Cryptography Team has again added the workaround for supporting old packages too.
(Ref. Link: <a href="https://github.com/pyca/cryptography/issues/3150" rel="nofollow">https://github.com/pyca/cryptography/issues/3150</a> )</p>

python django cryptography google-compute-engine