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

System-installed Python dir is used for installing dependencies #259

Open
sybrenstuvel opened this issue Apr 28, 2024 · 0 comments
Open

Comments

@sybrenstuvel
Copy link

Hey folks,

In short: the wrong installation directory is used when installing the Python dependencies.

This is what my terminal shows when trying to enable BlenderCam 1.0.21 on Blender 4.1.1 / Windows 10 64-bit:

Read prefs: "C:\Users\Sybren\AppData\Roaming\Blender Foundation\Blender\4.1\config\userpref.blend"
addon_utils.disable: cam not loaded
Modules Installed (cam) from 'D:\\syncthing\\lasercutting\\software\\blendercam-1.0.21.zip' into 'C:\\Users\\Sybren\\AppData\\Roaming\\Blender Foundation\\Blender\\4.1\\scripts\\addons'
Defaulting to user installation because normal site-packages is not writeable
Looking in links: c:\Users\Sybren\AppData\Local\Temp\tmp2kc59_9g
Requirement already satisfied: setuptools in c:\program files\blender foundation\blender 4.1\4.1\python\lib\site-packages (63.2.0)
Requirement already satisfied: pip in c:\program files\blender foundation\blender 4.1\4.1\python\lib\site-packages (23.2.1)
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: pip in c:\program files\blender foundation\blender 4.1\4.1\python\lib\site-packages (23.2.1)
Collecting pip
  Obtaining dependency information for pip from https://files.pythonhosted.org/packages/8a/6a/19e9fe04fca059ccf770861c7d5721ab4c2aebc539889e97c7977528a53b/pip-24.0-py3-none-any.whl.metadata
  Using cached pip-24.0-py3-none-any.whl.metadata (3.6 kB)
Using cached pip-24.0-py3-none-any.whl (2.1 MB)
Installing collected packages: pip
  WARNING: The scripts pip.exe, pip3.11.exe and pip3.exe are installed in 'C:\Users\Sybren\AppData\Roaming\Python\Python311\Scripts' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed pip-24.0

[notice] A new release of pip is available: 23.2.1 -> 24.0
[notice] To update, run: C:\Program Files\Blender Foundation\Blender 4.1\4.1\python\bin\python.exe -m pip install --upgrade pip
Defaulting to user installation because normal site-packages is not writeable
Collecting shapely
  Downloading shapely-2.0.4-cp311-cp311-win_amd64.whl.metadata (7.2 kB)
Collecting Equation
  Downloading Equation-1.2.01.zip (25 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Collecting opencamlib
  Downloading opencamlib-2023.1.11-cp311-cp311-win_amd64.whl.metadata (47 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 47.8/47.8 kB 2.3 MB/s eta 0:00:00
Requirement already satisfied: numpy<3,>=1.14 in c:\program files\blender foundation\blender 4.1\4.1\python\lib\site-packages (from shapely) (1.24.3)
Downloading shapely-2.0.4-cp311-cp311-win_amd64.whl (1.4 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.4/1.4 MB 8.3 MB/s eta 0:00:00
Downloading opencamlib-2023.1.11-cp311-cp311-win_amd64.whl (272 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 272.5/272.5 kB 8.5 MB/s eta 0:00:00
Building wheels for collected packages: Equation
  Building wheel for Equation (pyproject.toml) ... done
  Created wheel for Equation: filename=Equation-1.2.1-py3-none-any.whl size=16262 sha256=a7328e17a97109466639575cfbe7a1f5ff24e8cc5cfb0d611c7fb60919b58dfb
  Stored in directory: c:\users\sybren\appdata\local\pip\cache\wheels\6d\6e\9a\5957d601b8310909854d888d13636e0603c1eff517ff95fc59
Successfully built Equation
Installing collected packages: Equation, shapely, opencamlib
Successfully installed Equation-1.2.1 opencamlib-2023.1.11 shapely-2.0.4
Traceback (most recent call last):
  File "C:\Program Files\Blender Foundation\Blender 4.1\4.1\scripts\modules\addon_utils.py", line 376, in enable
    mod = importlib.import_module(module_name)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Blender Foundation\Blender 4.1\4.1\python\Lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "C:\Users\Sybren\AppData\Roaming\Blender Foundation\Blender\4.1\scripts\addons\cam\__init__.py", line 42, in <module>
    from .cam_operation import camOperation
  File "C:\Users\Sybren\AppData\Roaming\Blender Foundation\Blender\4.1\scripts\addons\cam\cam_operation.py", line 9, in <module>
    from shapely import geometry as sgeometry
ModuleNotFoundError: No module named 'shapely'

As you can see, it picks up my system-installed Python 3.11's pip, and installs the dependencies neatly in C:\Users\Sybren\AppData\Roaming\Python\Python311\site-packages\shapely, which is not on Blender's search path:

PYTHON INTERACTIVE CONSOLE 3.11.7 (main, Feb  5 2024, 18:45:06) [MSC v.1928 64 bit (AMD64)]

Builtin Modules:       bpy, bpy.data, bpy.ops, bpy.props, bpy.types, bpy.context, bpy.utils, bgl, gpu, blf, mathutils
Convenience Imports:   from mathutils import *; from math import *
Convenience Variables: C = bpy.context, D = bpy.data

>>> import sys
>>> print('\n'.join(sys.path))
C:\Users\Sybren\AppData\Roaming\Blender Foundation\Blender\4.1\scripts\startup
C:\Program Files\Blender Foundation\Blender 4.1\4.1\scripts\startup
C:\Users\Sybren\AppData\Roaming\Blender Foundation\Blender\4.1\scripts\addons\flamenco\wheels\python_dateutil-2.8.2-py2.py3-none-any.whl
C:\Users\Sybren\AppData\Roaming\Blender Foundation\Blender\4.1\scripts\addons\flamenco\wheels\six-1.16.0-py2.py3-none-any.whl
C:\Program Files\Blender Foundation\Blender 4.1\4.1\scripts\modules
C:\Program Files\Blender Foundation\Blender 4.1\python311.zip
C:\Program Files\Blender Foundation\Blender 4.1\4.1\python\DLLs
C:\Program Files\Blender Foundation\Blender 4.1\4.1\python\Lib
C:\Program Files\Blender Foundation\Blender 4.1
C:\Program Files\Blender Foundation\Blender 4.1\4.1\python
C:\Program Files\Blender Foundation\Blender 4.1\4.1\python\Lib\site-packages
C:\Program Files\Blender Foundation\Blender 4.1\4.1\scripts\freestyle\modules
C:\Program Files\Blender Foundation\Blender 4.1\4.1\scripts\addons\modules
C:\Users\Sybren\AppData\Roaming\Blender Foundation\Blender\4.1\scripts\addons\modules
C:\Program Files\Blender Foundation\Blender 4.1\4.1\scripts\startup\bl_ui
C:\Program Files\Blender Foundation\Blender 4.1\4.1\scripts\addons
C:\Users\Sybren\AppData\Roaming\Blender Foundation\Blender\4.1\scripts\addons
C:\Program Files\Blender Foundation\Blender 4.1\4.1\scripts\addons_contrib

Workaround

As a workaround, I moved the dependencies into C:\Users\Sybren\AppData\Roaming\Blender Foundation\Blender\4.1\scripts\addons\modules and restarted Blender. Then enabling the add-on works fine.

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