Rickaym / manim-sideview

A Manim utility extension for Visual Studio Code.
https://marketplace.visualstudio.com/items?itemName=Rickaym.manim-sideview
MIT License
99 stars 11 forks source link

Run venv activate before running #67

Closed felipefcm closed 8 months ago

felipefcm commented 10 months ago

I'm having some issues importing my own packages because the extension doesn't seem to be activating the virtual env before running. I need at least a way to tell the extension some paths to append to sys.path.

My workaround for this was to make a copy of .venv/bin/manim and manually add the paths there, and configure the extension to use that executable.

matejaputic commented 10 months ago

Having the same issue, except with conda

Rickaym commented 9 months ago

0588f831eda0fe274f79220ec4b165f6b3888378 bebdfb8b184a59ef4884826c0b7bd888e57d9374 implements this

They will be released as 0.2.6

Rickaym commented 9 months ago

7ee1ca5

felipefcm commented 9 months ago

Unfortunately having issues with the new version: Screenshot_20231007_202414-1

The command being run is right. All the paths too. But for some reason it gets stuck. If I press Enter, an error is thrown mixing some paths together which is suspicious:

Screenshot_20231007_203114

See how it shows activateon? Also the directorype, where pe comes from the path. However, after the error, the environment is activated. I can see the (.venv) at the beginning of the line.

If I try to run the extension again, now that the environment is activated, it tries to run a weird command: Screenshot_20231007_203552

The .venv/Scripts folder doesn't exist. That's when I don't override the executable path. If I set the extension executable path with an absolute path to the manim executable (inside .venv/bin), it runs the Scripts folder anyway.

Let me know if I can provide any other info about this.

mikebarkmin commented 9 months ago

I think this line is not correct for all OS (https://github.com/Rickaym/manim-sideview/blob/7ee1ca5e9010bf82147f1a86bc7f5ec2443ed05c/src/sideview.ts#L270).

The scripts folder exists only on Windows. MacOS and Linux there is a bin folder (see https://github.com/pypa/virtualenv/commit/993ba1316a83b760370f5a3872b3f5ef4dd904c1). So we probably have to do an operating system check:

process.platform==='win32'
process.platform==='darwin'
process.platform==='linux'

A workaround for the current build is to use this path to the manim executable: ../bin/manim.

Rickaym commented 8 months ago

I have implemented mike's point on different operating systems having different virtual env folders. This should be released now with 0.2.9. It would be great if someone can test this out and verify that it is working as intended.