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

snap adds hidden --user flag when running pip from within FC #68

Open
luzpaz opened this issue Oct 31, 2022 · 0 comments
Open

snap adds hidden --user flag when running pip from within FC #68

luzpaz opened this issue Oct 31, 2022 · 0 comments

Comments

@luzpaz
Copy link
Collaborator

luzpaz commented Oct 31, 2022

Gist

So there's something unusual about the copy of Python that's executing inside the FreeCAD Snap -- it doesn't operate the same way as the normal system Python. The results of the earlier testing make it seem like it has an addition hidden "--user" parameter, or something along those lines.

Background

Trying to install the new BlenderBIM workbench I ran in to some problems that @chennes has been helping me troubleshoot. For some reason the snap doesn't like installing the ifcopenshell 3rd party dependency. We opened a ticket for it at FreeCAD/FreeCAD#12967 but most of the troubleshooting happened in our DMs

At first FreeCAD would just hang: https://forum.freecadweb.org/viewtopic.php?p=635481#p635481
Chennes provided a fix to the addon manager: FreeCAD/FreeCAD#7634
Results discussion thread
image
Then we tried on the FC console: discussion thread
We then moved to DMs eventually narrowing it down to the code block below.
Important note: I was able to install via pip in my OS's CLI

$ python -m pip install --target /home/beast/snap/freecad/common/AdditionalPythonPackages ifcopenshell
Collecting ifcopenshell
  Downloading ifcopenshell-0.7.0-221014-py310-none-manylinux1_x86_64.whl (40.9 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 40.9/40.9 MB 2.2 MB/s eta 0:00:00
Installing collected packages: ifcopenshell
Successfully installed ifcopenshell-0.7.0

About info

OS: Ubuntu Core 20 (KDE/plasma)
Word size of FreeCAD: 64-bit
Version: 0.21.30769 (Git) Snap 396
Build type: Release
Branch: master
Hash: 1282fdb7e8a721e9b411358d68daf8921b0bf50a
Python 3.8.10, Qt 5.15.5, Coin 4.0.0, Vtk 7.1.1, OCC 7.6.3
Locale: English/United States (en_US)
Installed mods: 
  * TabBar
  * ExtremeProDark 2.3.3
  * FreeCAD-BlenderBIM 2022.10.20

Reproduce

  • Start FreeCAD snap from the CLI
  • In the FreeCAD UI code console paste the following:
import subprocess
import addonmanager_utilities as utils
python_exe = utils.get_python_exe()
args = [python_exe, '-m', 'pip', 'install', '--disable-pip-version-check', '--target', '/home/beast/snap/freecad/common/AdditionalPythonPackages', 'ifcopenshell']
try:
    proc = subprocess.run(args, check=True)
except Exception as e:
    print(e)

Result: This will error out but...

  • Look at the CLI output
    Result: ERROR: Can not combine '--user' and '--target'

Notice how --user wasn't invoked at all in the args array

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant