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

Not able to resolve Blender path #3

Open
jayliu50 opened this issue Jul 6, 2024 · 7 comments
Open

Not able to resolve Blender path #3

jayliu50 opened this issue Jul 6, 2024 · 7 comments

Comments

@jayliu50
Copy link

jayliu50 commented Jul 6, 2024

Not sure what I did wrong.

I keep getting an error such as the following for 3.10, 3.11, and 3.12

PS Z:\win-code\github\st2> b3denv
 _   ___   _
| |_|_  |_| |___ ___ _ _
| . |_  | . | -_|   | | |
|___|___|___|___|_|_|\_/ v0.0.15
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\me\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\Scripts\b3denv.exe\__main__.py", line 7, in <module>
  File "C:\Users\me\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\b3denv\__init__.py", line 392, in main
    vars = get_vars(None)
           ^^^^^^^^^^^^^^
  File "C:\Users\me\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\b3denv\__init__.py", line 96, in get_vars
    python_folder = os.path.join(parent, version, "python\\bin")
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen ntpath>", line 149, in join
  File "<frozen genericpath>", line 164, in _check_arg_types
TypeError: join() argument must be str, bytes, or os.PathLike object, not 'NoneType'

I've tried setting the BLENDER_PATH.

I've also tried install 4.11 using the Blender installer, choosing the default installation path.

Nothing works.

@stenson
Copy link
Collaborator

stenson commented Jul 9, 2024

where is your blender installed? (e.g. mine is installed at C:\Program Files\Blender Foundation\Blender 4.1)

@jayliu50
Copy link
Author

jayliu50 commented Jul 10, 2024

In trying to get this to work, I've installed it in two places

One is the default C:\Program Files\Blender Foundation\Blender 4.1
The other is C:\Program Files\WindowsApps\BlenderFoundation.Blender_4.1.1.0_x64__ppwjx1n5r4v9t\Blender assigned by the MS Store.

@stenson
Copy link
Collaborator

stenson commented Jul 10, 2024

Are you able to see a python executable file in the file explorer at "C:\Program Files\Blender Foundation\Blender 4.1\4.1\python\bin\python.exe"?

@jayliu50
Copy link
Author

Yes, it's there in both locations

PS Z:\win-code\github\st2> dir 'C:\Program Files\Blender Foundation\Blender 4.1\4.1\python\bin\python.exe'

    Directory: C:\Program Files\Blender Foundation\Blender 4.1\4.1\python\bin

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a---           2/22/2024  2:22 PM          91136 python.exe

PS Z:\win-code\github\st2> dir 'C:\Program Files\WindowsApps\BlenderFoundation.Blender_4.1.1.0_x64__ppwjx1n5r4v9t\Blender\4.1\python\bin\python.exe'

    Directory: C:\Program
Files\WindowsApps\BlenderFoundation.Blender_4.1.1.0_x64__ppwjx1n5r4v9t\Blender\4.1\python\bin

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a---           3/26/2024  1:30 PM          91136 python.exe

@stenson
Copy link
Collaborator

stenson commented Jul 10, 2024

huh, not sure what the issue could be then, as that's exactly the same as on my windows computer where b3denv is working correctly.

I'm not sure why it'd be an issue, but the only thing I'm seeing different here is that you're running code from the Z drive (if i'm reading that correctly?). Could you try installing/running b3denv from the C drive instead? That might be a total garden path but I guess worth trying.

@jayliu50
Copy link
Author

jayliu50 commented Jul 10, 2024

I think I see the issue (but don't know of the solution)

First,

Around line 86, parent is C:\Program Files\WindowsApps\BlenderFoundation.Blender_4.1.1.0_x64__ppwjx1n5r4v9t and NOT C:\Progrfam Files\WindowsApps\BlenderFoundation.Blender_4.1.1.0_x64__ppwjx1n5r4v9t\Blender

    elif on_windows():
        version = None
        parent = os.path.dirname(blender)
        #### Parent is actually C:\Program Files\WindowsApps\BlenderFoundation.Blender_4.1.1.0_x64__ppwjx1n5r4v9t ####
        # parent = blender # this will work

        for p in os.listdir(parent):
            if os.path.isdir(os.path.join(parent, p)):
                name = os.path.basename(p)
                if re.match(r"[234]{1}\.[0-9]{1,2}", name):
                    version = name

        python_folder = os.path.join(parent, version, "python\\bin")

Second, it doesn't seem to listen to the environment variable I set for BLENDER_PATH. When I execute the following in my powershell and print parent at 97, I still get C:\Program Files\WindowsApps\BlenderFoundation.Blender_4.1.1.0_x64__ppwjx1n5r4v9t

PS Z:\win-code\github\st2> $BLENDER_PATH = "C:\Program Files\Blender Foundation\Blender 4.1"
PS Z:\win-code\github\st2> echo $BLENDER_PATH
C:\Program Files\Blender Foundation\Blender 4.1
PS Z:\win-code\github\st2> py -3.12 -m b3denv
C:\Users\jayliu\AppData\Local\Programs\Python\Python312\Lib\site-packages\b3denv\__init__.py:370: SyntaxWarning: invalid escape sequence '\_'
  """ _   ___   _
 _   ___   _
| |_|_  |_| |___ ___ _ _
| . |_  | . | -_|   | | |
|___|___|___|___|_|_|\_/ v0.0.15
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\jayliu\AppData\Local\Programs\Python\Python312\Lib\site-packages\b3denv\__main__.py", line 4, in <module>
    main()
  File "C:\Users\jayliu\AppData\Local\Programs\Python\Python312\Lib\site-packages\b3denv\__init__.py", line 392, in main
    vars = get_vars(None)
           ^^^^^^^^^^^^^^
  File "C:\Users\jayliu\AppData\Local\Programs\Python\Python312\Lib\site-packages\b3denv\__init__.py", line 96, in get_vars
    python_folder = os.path.join(parent, version, "python\\bin")
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen ntpath>", line 149, in join
  File "<frozen genericpath>", line 164, in _check_arg_types
TypeError: join() argument must be str, bytes, or os.PathLike object, not 'NoneType'

If I can force the parent to be the path including \Blender it can continue (into the next error)


Alternatively, if I just set the variable blender on line 16 to be C:\Program Files\Blender Foundation\Blender 4.1\Blender instead of C:\Program Files\WindowsApps\BlenderFoundation.Blender_4.1.1.0_x64__ppwjx1n5r4v9t\Blender then it works fine. I can even build ST2 using the commands in build_win.sh and get a resulting add-on zip file. The result of that is This addon was unable to install correctly. but I can save that for another issue.

The WindowsApp blender path seems to have yet other issues, as well. For example, not being able to launch blender.exe and even with elevated Powershell! Launching blender-launcher.exe seems to be the only way to go.

@stenson
Copy link
Collaborator

stenson commented Jul 10, 2024

yeah I don't really know man, I don't have a lot of time to work on this and I hate using windows. I'm able to specify BLENDER_PATH versions like this and get a totally working ST2 install if I run these commands inside the ST2 directory. I think you might be missing the blender.exe part at the end of the BLENDER_PATH setting?

BLENDER_PATH="C:\\Program Files\\Blender Foundation\\Blender 4.0\\blender.exe" b3denv paths
BLENDER_PATH="C:\\Program Files\\Blender Foundation\\Blender 4.0\\blender.exe" b3denv setup
BLENDER_PATH="C:\\Program Files\\Blender Foundation\\Blender 4.0\\blender.exe" b3denv

The build_win.sh file isn't used anymore, you can just do b3denv setup instead

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

2 participants