When I run the ESP-IDF 5.2 PowerShell shortcut it all works but there is a warning message "Setting PYTHONNOUSERSITE, was not set". Is it important and how can I fix whatever is causing the message?
Thanks
Steve
Setting PYTHONNOUSERSITE, was not set
- stevenbennett
- Posts: 34
- Joined: Sun May 19, 2024 7:30 am
- Location: High Bentham, UK
Re: Setting PYTHONNOUSERSITE, was not set
Hello Steve,
PYTHONNOUSERSITE is defined here: https://python.readthedocs.io/en/v2.7.2 ... NOUSERSITE
From PEP 370 definition:
So basically you donť have to do anything if everything works for you.
But it looks like the IDF environment was probably not installed correctly, so if you want to get rid of the text I suppose reinstallation of the framework should work.
Because you mentioned the ESP-IDF 5.2 PowerShell shortcut, I believe you have used the IDF Installer, so you can stay with this option and install the framework into the already installed ESP-IDF directory and later delete the original one. (maybe there could be a newer version of the installer https://dl.espressif.com/dl/esp-idf/)
I hope this helps you to understand the PYTHONNOUSERSITE and as said above if everything works, basically you do not have to do anything about the warning.
Regards,
Jakub
PYTHONNOUSERSITE is defined here: https://python.readthedocs.io/en/v2.7.2 ... NOUSERSITE
From PEP 370 definition:
When you run ESP-IDF 5.2 PowerShell shortcut the check for PYTHONNOUSERSITE value is performed. If it is not set the variable is set automatically. It is handled by these few lines which are run everytime you run ESP-IDF 5.2 PowerShell shortcut:user site directory
A site directory inside the users’ home directory. A user site directory is specific to a Python version. The path contains the version number (major and minor only).
Windows
%APPDATA%/Python/Python26/site-packages
Code: Select all
# Set PYTHONNOUSERSITE to avoid loading of Python packages from AppData\Roaming profile
if ($null -eq $env:PYTHONNOUSERSITE) {
"Setting PYTHONNOUSERSITE, was not set"
$env:PYTHONNOUSERSITE="True"
}
But it looks like the IDF environment was probably not installed correctly, so if you want to get rid of the text I suppose reinstallation of the framework should work.
Because you mentioned the ESP-IDF 5.2 PowerShell shortcut, I believe you have used the IDF Installer, so you can stay with this option and install the framework into the already installed ESP-IDF directory and later delete the original one. (maybe there could be a newer version of the installer https://dl.espressif.com/dl/esp-idf/)
I hope this helps you to understand the PYTHONNOUSERSITE and as said above if everything works, basically you do not have to do anything about the warning.
Regards,
Jakub
- stevenbennett
- Posts: 34
- Joined: Sun May 19, 2024 7:30 am
- Location: High Bentham, UK
Re: Setting PYTHONNOUSERSITE, was not set
Thank you for the comments Jakub; I pleased that all should be OK despite the warning message. I seem to have Python in the following locations:
e:\ESP_tool>where python
C:\Program Files\Python312\python.exe
C:\Users\Steven\.espressif\python_env\idf5.2_py3.12_env\Scripts\python.exe
C:\Users\Steven\AppData\Local\Microsoft\WindowsApps\python.exe
If I wanted to Set PYTHONNOUSERSITE permanently is there a way to do this? I don't understand the concept of a Python HOME, or any other, directory (folder I assume?), so that's where I'm starting from.
e:\ESP_tool>where python
C:\Program Files\Python312\python.exe
C:\Users\Steven\.espressif\python_env\idf5.2_py3.12_env\Scripts\python.exe
C:\Users\Steven\AppData\Local\Microsoft\WindowsApps\python.exe
If I wanted to Set PYTHONNOUSERSITE permanently is there a way to do this? I don't understand the concept of a Python HOME, or any other, directory (folder I assume?), so that's where I'm starting from.
Re: Setting PYTHONNOUSERSITE, was not set
Hello Steven,
When using ESP-IDF installed by IDF Installer, there is a bundled Python included, to not mess up your environment.
This Python is used in the created environment every time when running the ESP-IDF shortcut.
That is why the warning is there every time because the variable is set in this created environment.
If you add the PYTHONNOUSERSITE variable to your System environment variables with the value corresponding to "True" it should solve it.
But maybe there is a reason why you don't have the variable set to the value because of some other use cases so that is why you don't need to do anything to not mess up your environment and let the variable be set only in a newly created environment in the scope os ESP-IDF shortcut.
Hope this helps.
Best regards,
Jakub
When using ESP-IDF installed by IDF Installer, there is a bundled Python included, to not mess up your environment.
This Python is used in the created environment every time when running the ESP-IDF shortcut.
That is why the warning is there every time because the variable is set in this created environment.
If you add the PYTHONNOUSERSITE variable to your System environment variables with the value corresponding to "True" it should solve it.
But maybe there is a reason why you don't have the variable set to the value because of some other use cases so that is why you don't need to do anything to not mess up your environment and let the variable be set only in a newly created environment in the scope os ESP-IDF shortcut.
Hope this helps.
Best regards,
Jakub
- stevenbennett
- Posts: 34
- Joined: Sun May 19, 2024 7:30 am
- Location: High Bentham, UK
Re: Setting PYTHONNOUSERSITE, was not set
Yes I see your point Jakub, I will take your advice and just leave it. I'm afraid I am one of those people that don't like to see any messages that suggest something could be fixed!
Thank you for your help
Steve
Thank you for your help
Steve
Who is online
Users browsing this forum: Baidu [Spider], Orange_Murker and 81 guests