Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot install package bpy using pip

Problem description: In VS Code, run the command pip install bpy (as indicated in https://pypi.org/project/bpy/) and get the following error message:

PS C:\Users\(...)\Local\Programs\Python\Python38> pip install bpy
Collecting bpy
  Using cached bpy-0.0.0a0.tar.gz (19 kB)
    ERROR: Command errored out with exit status 1:
     command: 'c:\users\(...)\local\programs\python\python38\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\(...)\\Local\\Temp\\pip-install-xln6pb4c\\bpy\\setup.py'"'"'; __file__='"'"'C:\\Users\\(...)\\Local\\Temp\\pip-install-xln6pb4c\\bpy\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\(...)\Local\Temp\pip-pip-egg-info-0pdk7e9q'
         cwd: C:\Users\(...)\Local\Temp\pip-install-xln6pb4c\bpy\
    Complete output (16 lines):
    Traceback (most recent call last):
      File "c:\users\(...)\local\programs\python\python38\lib\tokenize.py", line 342, in find_cookie
        codec = lookup(encoding)
    LookupError: unknown encoding: future_fstrings
    During handling of the above exception, another exception occurred:
      File "<string>", line 1, in <module>
      File "c:\users\(...)\local\programs\python\python38\lib\tokenize.py", line 394, in open
        encoding, lines = detect_encoding(buffer.readline)
      File "c:\users\(...)\local\programs\python\python38\lib\tokenize.py", line 381, in detect_encoding
        encoding = find_cookie(second)
      File "c:\users\(...)\local\programs\python\python38\lib\tokenize.py", line 350, in find_cookie
        raise SyntaxError(msg)
    SyntaxError: unknown encoding for 'C:\\Users\\(...)\\Local\\Temp\\pip-install-xln6pb4c\\bpy\\setup.py': future_fstrings
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output. code here

------- What I tried (without success): -------

Installed wheels (pip install wheel), then downloaded the package from pypi.org to manually install: pip install 'C:\Users(...)\Downloads\bpy-2.82.1.tar.gz' got the same error.

------- Conclusion: -------

Cannot use bpy outside of Blender. I found some workarounds (which I have yet to try) on another post on Blender Stack Exchange Thanks Anand and phd for the very useful links!

like image 791
Filipe Rei Avatar asked Jul 22 '26 09:07

Filipe Rei


1 Answers

From what I understand it is actually possible to run bpy outside blender and information that claims otherwise was written for older versions. I have to admit though that I am still in progress of installing bpy which is not an easy task and I cannot verify this, yet.

In your case, a pip module is missing. You can install it with pip install future_fstrings. Have a look at https://pypi.org/project/bpy/ for more guidelines.

EDIT: I was able to install bpy under Windows and Linux. It throws some errors on Linux but works fine under Windows. And absolutely works standalone!

like image 135
paulgavrikov Avatar answered Jul 24 '26 22:07

paulgavrikov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!