0
$\begingroup$

thx for the patience. I'm not very familiar with python and I am trying to use a tabulate import but get errors.

Traceback (most recent call last): File "\CheckObejctSize.py", line 5, in ModuleNotFoundError: No module named 'tabulate' Error: Python script failed, check the message in the system console

I've read a whole bunch of threads on what to do, but none have helped. I was going to use the blender/pip to add tabulate but I can't seem to even find pip.

I found a thread that suggested:

import ensurepip
ensurepip.bootstrap()
pybin = bpy.app.binary_path_python
subprocess.check_call([pybin, '-m', 'pip', 'install', 'tabulate'])

which produced Defaulting to user installation because normal site-packages is not writeable Looking in links: c:\Users\Jon\AppData\Local\Temp\tmp99hzlnij Requirement already satisfied: setuptools in c:\program files\blender foundation\blender 3.0\3.0\python\lib\site-packages (57.4.0) Requirement already satisfied: pip in c:\program files\blender foundation\blender 3.0\3.0\python\lib\site-packages (21.2.3) Traceback (most recent call last): File "\CheckObejctSize.py", line 10, in AttributeError: 'bpy.app' object has no attribute 'binary_path_python' Error: Python script failed, check the message in the system console

Why can't I find pip when it seems that it's already there and how can I get tabulate import working in Blender 3.0 scripting?

$\endgroup$

1 Answer 1

0
$\begingroup$

Convoluted but I got it to work:

  • Download the get-pip.py file from the web. https://bootstrap.pypa.io/get-pip.py
  • Place it in ...Blender Foundation\Blender 3.0\3.0\python\bin
  • Run Blender Foundation\Blender 3.0\3.0\python> .\bin\python.exe ./bin/get-pip.py

You will see:

Collecting pip
  Downloading pip-22.0.3-py3-none-any.whl (2.1 MB)
     ---------------------------------------- 2.1/2.1 MB 8.3 MB/s eta 0:00:00
Collecting wheel
  Downloading wheel-0.37.1-py2.py3-none-any.whl (35 kB)
Installing collected packages: wheel, pip
  WARNING: The script wheel.exe is installed in 'C:\Program Files\Blender Foundation\Blender 3.0\3.0\python\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.
  Attempting uninstall: pip
    Found existing installation: pip 21.2.3
    Uninstalling pip-21.2.3:
      Successfully uninstalled pip-21.2.3
  WARNING: The scripts pip.exe, pip3.9.exe and pip3.exe are installed in 'C:\Program Files\Blender Foundation\Blender 3.0\3.0\python\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-22.0.3 wheel-0.37.1
  • This will have created a Scripts directory, now I can use pip3 to install
  • Blender Foundation\Blender 3.0\3.0\python> ./Scripts/pip3 install tabulate
$\endgroup$
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.