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

AttributeError: __exit__ with cffi 1.11 #971

Closed
Alphadelta14 opened this issue Nov 30, 2020 · 2 comments · Fixed by pyca/cryptography#5598
Closed

AttributeError: __exit__ with cffi 1.11 #971

Alphadelta14 opened this issue Nov 30, 2020 · 2 comments · Fixed by pyca/cryptography#5598

Comments

@Alphadelta14
Copy link

After #928 went into the most recent release, we saw pyOpenSSL breakage in pip.
I tracked this down to having cffi 1.11.5 and cryptography 3.2.1 already in our environments, but pyOpenSSL requires that 3.2 cryptography has at least cffi 1.12 in place (despite its requirement that it only needs 1.8).
Upgrading our cffi fixed the problem (after we fixed all of our corrupted environments).

To reproduce:

pip install cffi==1.11.5 cryptography==3.2.1
pip install pyOpenSSL==20.0.0
# any pip install command
pip install pyOpenSSL==19.1.0

Traceback:

Starting at 15:04:35
Collecting cffi==1.11.5
  Using cached cffi-1.11.5-cp37-cp37m-manylinux1_x86_64.whl (421 kB)
Collecting cryptography==3.2.1
  Using cached cryptography-3.2.1-cp35-abi3-manylinux2010_x86_64.whl (2.6 MB)
Requirement already satisfied: pycparser in ./virtualenvs/tmp-237b62f38097d99d/lib/python3.7/site-packages (from cffi==1.11.5) (2.20)
Requirement already satisfied: six>=1.4.1 in ./virtualenvs/tmp-237b62f38097d99d/lib/python3.7/site-packages (from cryptography==3.2.1) (1.15.0)
Installing collected packages: cffi, cryptography
Successfully installed cffi-1.11.5 cryptography-3.2.1
WARNING: You are using pip version 20.0.2; however, version 20.3 is available.
You should consider upgrading via the '/home/alpha/virtualenvs/tmp-237b62f38097d99d/bin/python3 -m pip install --upgrade pip' command.                                                              
(tmp-237b62f38097d99d) Completed at 15:04:38
alpha@chamber:~$ pip install pyOpenSSL==20.0.0
Starting at 15:04:48
Collecting pyOpenSSL==20.0.0
  Using cached pyOpenSSL-20.0.0-py2.py3-none-any.whl (54 kB)
Requirement already satisfied: cryptography>=3.2 in ./virtualenvs/tmp-237b62f38097d99d/lib/python3.7/site-packages (from pyOpenSSL==20.0.0) (3.2.1)
Requirement already satisfied: six>=1.5.2 in ./virtualenvs/tmp-237b62f38097d99d/lib/python3.7/site-packages (from pyOpenSSL==20.0.0) (1.15.0)
Requirement already satisfied: cffi!=1.11.3,>=1.8 in ./virtualenvs/tmp-237b62f38097d99d/lib/python3.7/site-packages (from cryptography>=3.2->pyOpenSSL==20.0.0) (1.11.5)
Requirement already satisfied: pycparser in ./virtualenvs/tmp-237b62f38097d99d/lib/python3.7/site-packages (from cffi!=1.11.3,>=1.8->cryptography>=3.2->pyOpenSSL==20.0.0) (2.20)
Installing collected packages: pyOpenSSL
Successfully installed pyOpenSSL-20.0.0
WARNING: You are using pip version 20.0.2; however, version 20.3 is available.
You should consider upgrading via the '/home/alpha/virtualenvs/tmp-237b62f38097d99d/bin/python3 -m pip install --upgrade pip' command.                                                              
(tmp-237b62f38097d99d) Completed at 15:04:49
alpha@chamber:~$ pip install pyOpenSSL==19.1
Starting at 15:05:11
ERROR: Exception:
Traceback (most recent call last):                                                                
  File "/home/alpha/virtualenvs/tmp-237b62f38097d99d/lib/python3.7/site-packages/pip/_internal/cli/base_command.py", line 186, in _main                                                             
    status = self.run(options, args)                                                              
  File "/home/alpha/virtualenvs/tmp-237b62f38097d99d/lib/python3.7/site-packages/pip/_internal/commands/install.py", line 331, in run                                                               
    resolver.resolve(requirement_set)                                                             
  File "/home/alpha/virtualenvs/tmp-237b62f38097d99d/lib/python3.7/site-packages/pip/_internal/legacy_resolve.py", line 177, in resolve                                                             
    discovered_reqs.extend(self._resolve_one(requirement_set, req))                               
  File "/home/alpha/virtualenvs/tmp-237b62f38097d99d/lib/python3.7/site-packages/pip/_internal/legacy_resolve.py", line 333, in _resolve_one                                                        
    abstract_dist = self._get_abstract_dist_for(req_to_install)                                   
  File "/home/alpha/virtualenvs/tmp-237b62f38097d99d/lib/python3.7/site-packages/pip/_internal/legacy_resolve.py", line 281, in _get_abstract_dist_for                                              
    req.populate_link(self.finder, upgrade_allowed, require_hashes)                               
  File "/home/alpha/virtualenvs/tmp-237b62f38097d99d/lib/python3.7/site-packages/pip/_internal/req/req_install.py", line 249, in populate_link                                                      
    self.link = finder.find_requirement(self, upgrade)                                            
  File "/home/alpha/virtualenvs/tmp-237b62f38097d99d/lib/python3.7/site-packages/pip/_internal/index/package_finder.py", line 899, in find_requirement                                              
    req.name, specifier=req.specifier, hashes=hashes,                                             
  File "/home/alpha/virtualenvs/tmp-237b62f38097d99d/lib/python3.7/site-packages/pip/_internal/index/package_finder.py", line 881, in find_best_candidate                                           
    candidates = self.find_all_candidates(project_name)                                           
  File "/home/alpha/virtualenvs/tmp-237b62f38097d99d/lib/python3.7/site-packages/pip/_internal/index/package_finder.py", line 826, in find_all_candidates                                           
    project_url, link_evaluator=link_evaluator,                                                   
  File "/home/alpha/virtualenvs/tmp-237b62f38097d99d/lib/python3.7/site-packages/pip/_internal/index/package_finder.py", line 790, in process_project_url                                           
    html_page = self._link_collector.fetch_page(project_url)                                      
  File "/home/alpha/virtualenvs/tmp-237b62f38097d99d/lib/python3.7/site-packages/pip/_internal/index/collector.py", line 497, in fetch_page                                                         
    return _get_html_page(location, session=self.session)                                         
  File "/home/alpha/virtualenvs/tmp-237b62f38097d99d/lib/python3.7/site-packages/pip/_internal/index/collector.py", line 337, in _get_html_page                                                     
    resp = _get_html_response(url, session=session)                                               
  File "/home/alpha/virtualenvs/tmp-237b62f38097d99d/lib/python3.7/site-packages/pip/_internal/index/collector.py", line 143, in _get_html_response                                                 
    "Cache-Control": "max-age=0",                                                                 
  File "/home/alpha/virtualenvs/tmp-237b62f38097d99d/lib/python3.7/site-packages/pip/_vendor/requests/sessions.py", line 546, in get
    return self.request('GET', url, **kwargs)
  File "/home/alpha/virtualenvs/tmp-237b62f38097d99d/lib/python3.7/site-packages/pip/_internal/network/session.py", line 405, in request
    return super(PipSession, self).request(method, url, *args, **kwargs)
  File "/home/alpha/virtualenvs/tmp-237b62f38097d99d/lib/python3.7/site-packages/pip/_vendor/requests/sessions.py", line 533, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/alpha/virtualenvs/tmp-237b62f38097d99d/lib/python3.7/site-packages/pip/_vendor/requests/sessions.py", line 646, in send
    r = adapter.send(request, **kwargs)
  File "/home/alpha/virtualenvs/tmp-237b62f38097d99d/lib/python3.7/site-packages/pip/_vendor/cachecontrol/adapter.py", line 53, in send
    resp = super(CacheControlAdapter, self).send(request, **kw)
  File "/home/alpha/virtualenvs/tmp-237b62f38097d99d/lib/python3.7/site-packages/pip/_vendor/requests/adapters.py", line 449, in send
    timeout=timeout
  File "/home/alpha/virtualenvs/tmp-237b62f38097d99d/lib/python3.7/site-packages/pip/_vendor/urllib3/connectionpool.py", line 672, in urlopen
    chunked=chunked,
  File "/home/alpha/virtualenvs/tmp-237b62f38097d99d/lib/python3.7/site-packages/pip/_vendor/urllib3/connectionpool.py", line 387, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/home/alpha/virtualenvs/tmp-237b62f38097d99d/lib/python3.7/http/client.py", line 1252, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/home/alpha/virtualenvs/tmp-237b62f38097d99d/lib/python3.7/http/client.py", line 1298, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/home/alpha/virtualenvs/tmp-237b62f38097d99d/lib/python3.7/http/client.py", line 1247, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/home/alpha/virtualenvs/tmp-237b62f38097d99d/lib/python3.7/http/client.py", line 1026, in _send_output
    self.send(msg)
  File "/home/alpha/virtualenvs/tmp-237b62f38097d99d/lib/python3.7/http/client.py", line 987, in send
    self.sock.sendall(data)
  File "/home/alpha/virtualenvs/tmp-237b62f38097d99d/lib/python3.7/site-packages/pip/_vendor/urllib3/contrib/pyopenssl.py", line 352, in sendall
    data[total_sent : total_sent + SSL_WRITE_BLOCKSIZE]
  File "/home/alpha/virtualenvs/tmp-237b62f38097d99d/lib/python3.7/site-packages/pip/_vendor/urllib3/contrib/pyopenssl.py", line 340, in _send_until_done
    return self.connection.send(data)
  File "/home/alpha/virtualenvs/tmp-237b62f38097d99d/lib/python3.7/site-packages/OpenSSL/SSL.py", line 1641, in send
    with _from_buffer(buf) as data:
AttributeError: __enter__
WARNING: You are using pip version 20.0.2; however, version 20.3 is available.
You should consider upgrading via the '/home/alpha/virtualenvs/tmp-237b62f38097d99d/bin/python3 -m pip install --upgrade pip' command.
(tmp-237b62f38097d99d) Completed at 15:05:11
@reaperhulk
Copy link
Member

Thanks for the report. We need to either declare a higher minimum here in pyOpenSSL or just bump the minimum dep on the cryptography side. I'm inclined to bump it on the cryptography side -- what do you think @alex?

@alex
Copy link
Member

alex commented Dec 1, 2020

Yeah, +1 on just doing this on the cryptographys ide. I'll do that now.

alex added a commit to alex/cryptography that referenced this issue Dec 1, 2020
reaperhulk pushed a commit to pyca/cryptography that referenced this issue Dec 1, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging a pull request may close this issue.

3 participants