Background: I’m a Python novice, but an experienced Windows developer. The Python Windows store package seemed like a great way for me to learn, but I quickly ran into complex error messages that really left a lot to be desired (shown below); the problem was I ran a setup.py script which tried to write into C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3… One of the explicit suggestions in the error message was to log into an administrator account, which goes against windows best practices, especially for a package targeted at beginner/educational use.
After a bit of digging, I found that a virtual environments may be general Python solution, but virtual environments are not exactly documented as a beginner feature. It seems to me that if the Microsoft Store package somehow sets up a virtual environment (or something like it, e.g. by defining an environment variable) in a user-specific directory, this sort of message could be avoided. Does this make sense?
Or perhaps there’s a simpler way, e.g. defining a environment variable pointing to a per-user directory. Would this be PYTHON_PATH?
Repro
- Install Python 3.9 from the windows store
- clone github/BurtHarris/pcbflow.git
cd pcbflowgit checkout try1python setup.py install
Error message
PS C:\try\pcbflow> python setup.py install
running install
error: can't create or remove files in install directory
The following error occurred while trying to add or remove files in the
installation directory:
[Errno 13] Permission denied: 'C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.9_3.9.1264.0_x64__qbz5n2kfra8p0\\Lib\\site-packages\\test-easy-install-18976.write-test'
The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:
C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1264.0_x64__qbz5n2kfra8p0\Lib\site-packages\
Perhaps your account does not have write access to this directory? If the
installation directory is a system-owned directory, you may need to sign in
as the administrator or "root" account. If you do not have administrative
access to this machine, you may wish to choose a different installation
directory, preferably one that is listed in your PYTHONPATH environment
variable.
For information on other options, you may wish to consult the
documentation at:
https://setuptools.readthedocs.io/en/latest/easy_install.html
Please make the appropriate changes for your system and try again.
(it’s actually just an override to install into the user site packages, which is managed by Windows in this case so it won’t collide with others and the “Reset my app” function will clear it out).