r/OpenPythonSCAD • • Jul 16 '25

Installing 3rd party/arbitrary Python libraries into Windows

given that the Windows version (and others?) now have an internal Python, this becomes something of an issue.

It used to work to e.g., install a library into the "main" Python and then access it from w/in OpenPythonSCAD, but now an installed library cannot be seen from w/in OPS, and attempting to install one using code:

import os, sys

os.system(sys.executable + '-m pip install -user gscrib')

doesn't seem to work since the test file responds with:

Parsing design (AST generation)... Running Python 3.12.9 without venv. ERROR: Traceback (most recent call last): File "<string>", line 1, in <module> ModuleNotFoundError: No module named 'gscrib'

Is anyone else trying to use things other than sys and math (which I believe still work?)

(this is with the new 2025-07-15)

4 Upvotes

6 comments sorted by

View all comments

Show parent comment

2

u/Alacritous13 Jul 17 '25

That might have been to keep the 7-4-25 build running, as I didn't update to 7-15-25 till today. That said, all of this was copied from another reddit post, I don't actually know what it's doing.

1

u/gadget3D Jul 17 '25

This evaluates the directory where your model sits in and appends it to sys.path.

With that in place you can easily import python files which sit NEXT to your model file.