0

I have 2 separate projects that I created in PyCharmCE2018.3.
The first project:

  • set up without a venv
  • its packages installed with pip are in Program Files\Python\Python37\Lib\site-packages, which is read-only
  • successfully made into an .exe using PyInstaller. All dependencies were found and accessed by PyInstaller's Analyzer without needing to add paths to the .spec (https://pythonhosted.org/PyInstaller/when-things-go-wrong.html)

The second project:

  • set up with a venv
  • its packages installed with pip are in 'projectroot\venv\Lib\site-packages', which is read-only
  • PyInstaller's Analyzer does not automatically find the imported modules on the default path and populates a list of the missing modules in projectroot\build\warn-projectname
  • adding projectroot\venv\Lib\site-packages as another path in the .spec causes PyInstaller to correctly look there, but then encounters the PermissionError:

    PermissionError: [Errno 13] Permission denied: '\\projectroot\\venv\\Lib\\site-packages'

(Sorry, had trouble formatting the output, so I just put last line. It looks very similar to this: Permission Error When Trying to Use PyInstaller)

  • I copied \site-packages outside of the projectroot and added the path to the .spec. Again encountered the PermissionError for this new location.

Is there something special about venv which is causing this different reaction? Perhaps there's something else not on my radar? Thank you for your advice; I'm feeling a bit frustrated at the moment.

3/19/19 EDIT: I ended up removing PyCharm and the Python interpreter and did a fresh install. When setting up my environments again, I chose venv and used all the default suggestions. Then, I created a new project, dropped my script into that environment, and used pip to install the most recent versions of all my dependencies. Everything worked...with the exception of setuptools. At the suggestion of some other post (I've forgotten now where it was), I checked to see what version of setuptools the system environment was running. It was outdated and I updated it. Lo and behold, everything then worked like a charm (pun intended). This other post claimed that venv's isolation was not always complete and I may have stumbled across a related issue. In any case, setuptools was unrelated to the original issue and I suspect I was having pathing errors that were reset with the fresh install.

E Rind
  • 53
  • 5
  • Hello, welcome to Stack Overflow! Just a quick question: how did you create your virtual environment? Just wondering if it is a permission problem (no idea how PyCharm works and if it lets you create a virtualenv, but it might be that the permissions are locked down to the editor?) – Samuele Mattiuzzo Mar 11 '19 at 16:01
  • @SamueleMattiuzzo Thank you for reaching out. It was a busy week at work and I'm just now getting around to updating this. I looked into the permission angle, but it led me to a fishy set of errors that smelled like pathing problems. See my edit for more details. – E Rind Mar 20 '19 at 00:19

0 Answers0