TylerGubala / blenderpy

Blender as a python module with easy-install
GNU General Public License v3.0
314 stars 30 forks source link

How to install in a venv using poetry? #105

Open BenjixLeGaulois opened 2 years ago

BenjixLeGaulois commented 2 years ago

Hi, I am experiencing issues trying to install bpy dependencies in a virtual environnement using poetry. I am using Windows 10. When running the command poetry add bpy, everything works fine (I had to use python 3.7.9 in order to properly install it). However, when I running a python script with the only command import bpy, I get the following errors about npy_types.

Color management: using fallback mode for management
Color management: Error could not find role data role.
BLT_lang_init: 'locale' data path for translations not found, continuing
Color management: scene view "Filmic" not found, setting default "Standard".
AL lib: (EE) SetChannelMap: Failed to match front-center channel (2) in channel map
bpy: couldn't find 'scripts/modules', blender probably wont start.
Freestyle: couldn't find 'scripts/freestyle/modules', Freestyle won't work properly.
ModuleNotFoundError: No module named 'bpy_types'
ModuleNotFoundError: No module named 'bpy_types'
ERROR (bpy.rna): C:\Users\TGubs\Code\Python\blenderpy\build\temp.win-amd64-3.7\Release\blender\source\blender\python\intern\bpy_rna.c:7083 pyrna_srna_ExternalType: failed to find 'bpy_types' module
ModuleNotFoundError: No module named 'bpy_types'
ModuleNotFoundError: No module named 'bpy_types'
ERROR (bpy.rna): C:\Users\TGubs\Code\Python\blenderpy\build\temp.win-amd64-3.7\Release\blender\source\blender\python\intern\bpy_rna.c:7083 pyrna_srna_ExternalType: failed to find 'bpy_types' module
ModuleNotFoundError: No module named 'bpy_types'
ERROR (bpy.rna): C:\Users\TGubs\Code\Python\blenderpy\build\temp.win-amd64-3.7\Release\blender\source\blender\python\intern\bpy_rna.c:7083 pyrna_srna_ExternalType: failed to find 'bpy_types' module
ModuleNotFoundError: No module named 'bpy_types'
ERROR (bpy.rna): C:\Users\TGubs\Code\Python\blenderpy\build\temp.win-amd64-3.7\Release\blender\source\blender\python\intern\bpy_rna.c:7083 pyrna_srna_ExternalType: failed to find 'bpy_types' module
ModuleNotFoundError: No module named 'bpy_types'
ERROR (bpy.rna): C:\Users\TGubs\Code\Python\blenderpy\build\temp.win-amd64-3.7\Release\blender\source\blender\python\intern\bpy_rna.c:7083 pyrna_srna_ExternalType: failed to find 'bpy_types' module
F1027 15:57:28.165184 31960 utilities.cc:322] Check failed: !IsGoogleLoggingInitialized() You called InitGoogleLogging() twice!
*** Check failure stack trace: ***

I know this is a reccurring issue but as far as I know, nothing has been documented about installing bpy using poetry. Any help is welcome šŸ˜ƒ Many thanks!

TylerGubala commented 2 years ago

Did you run the script

"bpy_post_install"

After adding bpy? It's a required step.

On Wed, Oct 27, 2021, 10:07 AM BenjixLeGaulois @.***> wrote:

Hi, I am experiencing issues trying to install bpy dependencies in a virtual environnement using poetry. I am using Windows 10. When running the command poetry add bpy, everything works fine (I had to use python 3.7.9 in order to properly install it). However, when I running a python script with the only command import bpy, I get the following errors about npy_types.

Color management: using fallback mode for management

Color management: Error could not find role data role.

BLT_lang_init: 'locale' data path for translations not found, continuing

Color management: scene view "Filmic" not found, setting default "Standard".

AL lib: (EE) SetChannelMap: Failed to match front-center channel (2) in channel map

bpy: couldn't find 'scripts/modules', blender probably wont start.

Freestyle: couldn't find 'scripts/freestyle/modules', Freestyle won't work properly.

ModuleNotFoundError: No module named 'bpy_types'

ModuleNotFoundError: No module named 'bpy_types'

ERROR (bpy.rna): C:\Users\TGubs\Code\Python\blenderpy\build\temp.win-amd64-3.7\Release\blender\source\blender\python\intern\bpy_rna.c:7083 pyrna_srna_ExternalType: failed to find 'bpy_types' module

ModuleNotFoundError: No module named 'bpy_types'

ModuleNotFoundError: No module named 'bpy_types'

ERROR (bpy.rna): C:\Users\TGubs\Code\Python\blenderpy\build\temp.win-amd64-3.7\Release\blender\source\blender\python\intern\bpy_rna.c:7083 pyrna_srna_ExternalType: failed to find 'bpy_types' module

ModuleNotFoundError: No module named 'bpy_types'

ERROR (bpy.rna): C:\Users\TGubs\Code\Python\blenderpy\build\temp.win-amd64-3.7\Release\blender\source\blender\python\intern\bpy_rna.c:7083 pyrna_srna_ExternalType: failed to find 'bpy_types' module

ModuleNotFoundError: No module named 'bpy_types'

ERROR (bpy.rna): C:\Users\TGubs\Code\Python\blenderpy\build\temp.win-amd64-3.7\Release\blender\source\blender\python\intern\bpy_rna.c:7083 pyrna_srna_ExternalType: failed to find 'bpy_types' module

ModuleNotFoundError: No module named 'bpy_types'

ERROR (bpy.rna): C:\Users\TGubs\Code\Python\blenderpy\build\temp.win-amd64-3.7\Release\blender\source\blender\python\intern\bpy_rna.c:7083 pyrna_srna_ExternalType: failed to find 'bpy_types' module

F1027 15:57:28.165184 31960 utilities.cc:322] Check failed: !IsGoogleLoggingInitialized() You called InitGoogleLogging() twice!

Check failure stack trace:

I know this is a reccurring issue but as far as I know, nothing has been documented about installing bpy using poetry. Any help is welcome šŸ˜ƒ Many thanks!

ā€” You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/TylerGubala/blenderpy/issues/105, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFLEYR3MBN2JGPAGU7XPEV3UJAISRANCNFSM5G2OM3QQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

BenjixLeGaulois commented 2 years ago

Hi @TylerGubala,

Yes, I ran it just after the installation of bpy, within the virtual environnement (activated). The result of the command is the following:

Configuration complete, enjoy using Blender as a Python module!

However, I still get the errors when I try to import bpy in a script.

TylerGubala commented 2 years ago

What folder is your "python.exe" in for your virtual environment?

On Wed, Oct 27, 2021, 10:26 AM BenjixLeGaulois @.***> wrote:

Hi @TylerGubala https://github.com/TylerGubala,

Yes, I ran it just after the installation of bpy, within the virtual environnement (activated). The result of the command is the following:

Configuration complete, enjoy using Blender as a Python module!

However, I still get the errors when I try to import bpy in a script.

ā€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/TylerGubala/blenderpy/issues/105#issuecomment-952985865, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFLEYR5PJ5BEY5YJLSFJNRTUJAK37ANCNFSM5G2OM3QQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

BenjixLeGaulois commented 2 years ago

Hi @TylerGubala, The executable python.exe is in .venv/Scripts along with the folder 2.82.

- .venv
    - Lib
    - Scripts
        - 2.82
        - ...
        - python.exe
        - ...