VS code tool chain installer problem with pip when creating virtual python environment

ihouses
Posts: 19
Joined: Sun Jul 09, 2017 1:41 pm

VS code tool chain installer problem with pip when creating virtual python environment

Postby ihouses » Sat Dec 19, 2020 11:52 pm

Hi,

I have tried the new plugin for Visual Studio code, it is really promising but unfortunately I get an error related with one of the packages:

_openssl.c
C:\Python37\include\pyconfig.h(59): fatal error C1083: Cannot open include file: 'io.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.25.28610\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2

=============================DEBUG ASSISTANCE=============================
If you are seeing a compilation error please try the following steps to
successfully install cryptography:
1) Upgrade to the latest pip and try again. This will fix errors for most
users. See: https://pip.pypa.io/en/stable/installing/#upgrading-pip
2) Read https://cryptography.io/en/latest/installation.html for specific
instructions for your platform.
3) Check our frequently asked questions for more information:
https://cryptography.io/en/latest/faq.html
=============================DEBUG ASSISTANCE=============================

----------------------------------------
Failed building wheel for cryptography
Command "c:\esp\tools\.espressif\python_env\idf4.2_py3.7_env\Scripts\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Jose\\AppData\\Local\\Temp\\pip-install-pn7h479i\\cryptography\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\Jose\AppData\Local\Temp\pip-record-2_ugakdh\install-record.txt --single-version-externally-managed --compile --install-headers c:\esp\tools\.espressif\python_env\idf4.2_py3.7_env\include\site\python3.7\cryptography" failed with error code 1 in C:\Users\Jose\AppData\Local\Temp\pip-install-pn7h479i\cryptography\
You are using pip version 10.0.1, however version 20.3.3 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
Command failed: "c:\esp\tools\.espressif\python_env\idf4.2_py3.7_env\Scripts\python.exe" -m pip install -r "C:\Users\Jose\esp-idf\requirements.txt"
I have debugging the problem and I see that every time that I execute the Download button of the IDF tools the installer DELETE the existing python environment and overwrite the content (always with the old version of pip) so even if I upgrate pip properly doesn't have any effect because will be overwritted. BTW my normal python 3.7 has the last version of Pip.

So I really dont know how what so do now...

Any ideas?

Thanks!

ESP_georgik
Posts: 21
Joined: Fri Nov 06, 2020 8:23 am
Location: Brno
Contact:

Re: VS code tool chain installer problem with pip when creating virtual python environment

Postby ESP_georgik » Mon Dec 21, 2020 8:36 am

@ihouses Thank you for reporting the problem.

Please, try to upgrade your installation to the latest version of Python 3.7.

The problem that you've described indicates that Python 3.7 installation is old and contains pip 10.0.1.
The command virtualenv takes into account the version from the original installation when creating a new virtual environment.
Upgrading pip in the main installation of Python does not help, because virtualenv seeder does not take the modification into account.

The problem can be simulated in the following way:
- pip part

Code: Select all

pip --version
pip 20.3.3 from C:\....
- virtualenv part

Code: Select all

virtualenv newenv
created virtual environment CPython...
  creator CPython3Windows(dest=C:\..., clear=False, no_vcs_ignore=False, global=False)
  seeder PipInvoke(download=False, pip=10.0.1, setuptools=bundle, wheel=bundle)
    added seed packages: pip==10.0.1, ...
  activators ...
As you can see versions do not match. More information about virtualenv seeder is here: https://virtualenv.pypa.io/en/latest/cl ... ion-seeder

That's one part of the problem.

The second part of the problem:
Old pip 10.0.1 seems to fail with a resolution of Cryptography Wheel, so it attempts to compile it from source code.

The second problem should be fixed by using a newer version of Python 3.7 with newer pip which will be able to resolve the wheel with cryptography.
- Juraj Michálek
Senior Embedded Software Engineer at Espressif Systems

ihouses
Posts: 19
Joined: Sun Jul 09, 2017 1:41 pm

Re: VS code tool chain installer problem with pip when creating virtual python environment

Postby ihouses » Mon Dec 21, 2020 11:47 pm

Hello,

I tried to use the last python version 3.9 (I think) that has a much never version of pip but still fails.

As you see in my error log:

C:\Python37\include\pyconfig.h(59): fatal error C1083: Cannot open include file: 'io.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.25.28610\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2

I found out that the real problem was an non updated vs_build_tools. After updating that properly the build was complete.

This is a weird thing since I could compile thing for IDF ESP32 without problems and with a non updated version of vs_build_tools so there is a weird dependency here.

Thanks for the support!

Who is online

Users browsing this forum: No registered users and 86 guests