Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions docs/requirements.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ MacPorts](http://sourceforge.net/projects/pycam/forums/forum/860183/topic/380009
Please document your experiences here, if you successfully used PyCAM
with other operating systems.

**Note for Python 3.12+:** The deprecated `imp` module was removed in Python 3.12.
If you're running Python 3.12 or newer, make sure you have the latest version of PyCAM
with the updated plugin system that uses `importlib` instead.

Linux
-----

Expand Down Expand Up @@ -41,6 +45,26 @@ Run the following command in a *root* terminal:

yum install python3-gi python3-opengl

### Arch Linux

Run the following command in a terminal:

sudo pacman -S python-gobject python-opengl gtk3

### Using virtualenv

If you want to run PyCAM in a Python virtualenv, you need to create the virtualenv with
access to system site packages, since GTK and its Python bindings are typically installed
at the system level:

python -m venv --system-site-packages venv
source venv/bin/activate
pip install -r requirements.txt
python pycam/run_gui.py

Without the `--system-site-packages` flag, the virtualenv won't be able to access the
system-installed `python3-gi` (PyGObject) package, and PyCAM will fail to start.

Windows
-------

Expand Down
8 changes: 5 additions & 3 deletions pycam/Plugins/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
along with PyCAM. If not, see <http://www.gnu.org/licenses/>.
"""

import imp
import importlib.util
import inspect
import os
import uuid
Expand Down Expand Up @@ -268,9 +268,11 @@ def import_plugins(self, directory=None, ignore_names=None):
_log.info("Skipping plugin %s (marked as 'ignore')", mod_name)
continue
try:
mod_file, mod_filename, mod_desc = imp.find_module(mod_name, [directory])
mod_filename = os.path.join(directory, filename)
full_mod_name = "pycam.Plugins.%s" % mod_name
mod = imp.load_module(full_mod_name, mod_file, mod_filename, mod_desc)
spec = importlib.util.spec_from_file_location(full_mod_name, mod_filename)
mod = importlib.util.module_from_spec(spec)
spec.loader.exec_module(mod)
except ImportError as exc:
_log.info("Skipping plugin %s: %s", os.path.join(directory, filename), exc)
continue
Expand Down