[SOLVED] No module named 'camotics'

Here's the place for discussion related to CAM/CNC and the development of the Path module.
memfis
Posts: 377
Joined: Tue Nov 15, 2016 7:58 pm

[SOLVED] No module named 'camotics'

Post by memfis »

Colleagues,

I saw in git that there is some work being done on (?) integration or some kind of interaction with camotics. But apparently they forgot to "put" it in the dependency and even in the actual appimage
-
Снимок экрана от 2022-06-30 23-00-19.jpg
Снимок экрана от 2022-06-30 23-00-19.jpg (122.06 KiB) Viewed 564 times
Just in case - I'm not too lazy to compile (I don't need in normal cases) camotics -

pacman -Qs camotics
local/camotics-git r960.6942bd0-1
3axis NC machining simulation software


What am I doing wrong and how do I fix it?
Last edited by memfis on Sat Jul 02, 2022 12:36 pm, edited 2 times in total.
User avatar
sliptonic
Veteran
Posts: 2962
Joined: Tue Oct 25, 2011 10:46 pm
Location: Columbia, Missouri
Contact:

Re: No module named 'camotics'

Post by sliptonic »

Camotics is a third party application. If it's installed on the machine, Path will detect it and enable another button on the toolbar.

Several things to note:
First, this requires Camotics 1.2.2 which is currently not released. The latest version available on their site is 1.2.0. 1.2.2 requires you to build from source.
Second, there have been several bug reports and PRs just this week improving the version detection. We were checking for the install before enabling the control but accidentally trying to import the library elsewhere in the GUI which caused an error.

Remember, this is all in the development/master branch so bugs, especially this early in the 0.21/1.0 cycle are to be expected.
memfis
Posts: 377
Joined: Tue Nov 15, 2016 7:58 pm

Re: No module named 'camotics'

Post by memfis »

I used FreeCAD_weekly-builds-29365-2022-06-30-conda-Linux-x86_64-py310.AppImage, respectively counted on the "reference implementation". The error on the picture pops up according to the script -
1. running appimage
2. went to Path workbench
= saw the error.

I put camotics itself, built from source with git and it is version 1.2.2 -
Снимок экрана от 2022-06-30 23-28-06.jpg
Снимок экрана от 2022-06-30 23-28-06.jpg (251.49 KiB) Viewed 543 times
I will assume and suggest - do not rely on automatic version detection, but in the settings to provide the ability to explicitly specify the path to camotics.
User avatar
sliptonic
Veteran
Posts: 2962
Joined: Tue Oct 25, 2011 10:46 pm
Location: Columbia, Missouri
Contact:

Re: No module named 'camotics'

Post by sliptonic »

memfis wrote: Thu Jun 30, 2022 8:30 pm I will assume and suggest - do not rely on automatic version detection, but in the settings to provide the ability to explicitly specify the path to camotics.
Hmm. I'm not sure how to do this so it works with appimages.

The nature of the integration works in two ways. It uses a new python library. It also lets the user launch the full application with a project file created by Path.

I'm testing whether the camotics application is installed with

Code: Select all

subprocess.run(["camotics", "--version"])
That returns the version of the installed application. On my linux box the binary is /usr/bin/camotics. Based on that, I'm assuming the python library is also available and in the python path.

If I import the python library and check the file path:

Code: Select all

>>> import camotics
>>> camotics.__file__
'/usr/lib/python3/dist-packages/camotics.so'
Is it possible that the subprocess call succeeds because it finds the application on the host machine but importing fails because the library isn't in the appimage?

I could try importing the library only and checking the version with

Code: Select all

import camotics
>>> camotics.VERSION
(1, 2, 2)
But I assume that'll fail the other way or require the Appimage maintainer to include camotics. I don't know enough about appimage python library availability to resolve. Help appreciated.
chrisb
Veteran
Posts: 43646
Joined: Tue Mar 17, 2015 9:14 am

Re: No module named 'camotics'

Post by chrisb »

Workaround if camotics isn't installed:

If I edit Mod/Path/PathScripts/PathCamoticsGui.py and comment out everything, then the Path workbench works as before. I tested Profile, Pocket, Face.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
agren
Posts: 33
Joined: Sat Apr 20, 2019 7:37 am

Re: No module named 'camotics'

Post by agren »

memfis wrote: Thu Jun 30, 2022 8:30 pm I used FreeCAD_weekly-builds-29365-2022-06-30-conda-Linux-x86_64-py310.AppImage, respectively counted on the "reference implementation". The error on the picture pops up according to the script -
1. running appimage
2. went to Path workbench
= saw the error.
I might be misunderstanding something but I can't reproduce this. Path workbench loads in FreeCAD_weekly-builds-29365-2022-06-30-conda-Linux-x86_64-py310.AppImage.
The only thing missing is the CAMotics icon. But that's to be expected since the camotics module isn't bundled with the AppImage.

Screenshot at 2022-07-01.png
Screenshot at 2022-07-01.png (168.63 KiB) Viewed 478 times
chrisb
Veteran
Posts: 43646
Joined: Tue Mar 17, 2015 9:14 am

Re: No module named 'camotics'

Post by chrisb »

The latest available here is:

Code: Select all

OS: macOS 10.16
Word size of FreeCAD: 64-bit
Version: 0.21.29321 (Git)
Build type: Release
Branch: master
Hash: 8ee773362e08d703bce9cfdcefd8e4ad424a7d44
Python 3.10.5, Qt 5.12.9, Coin 4.0.0, Vtk 9.1.0, OCC 7.5.3
Locale: C/Default (C)
Installed mods: 
  * FC_SU
  * DynamicData 2.46.0
  * FeedsAndSpeeds 0.4.0
  * fcgear
  * Manipulator 1.4.3
  * fasteners
  * sheetmetal
  * ExplodedAssembly
  * Curves 0.3.0
  * Assembly4 0.11.12
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
memfis
Posts: 377
Joined: Tue Nov 15, 2016 7:58 pm

Re: No module named 'camotics'

Post by memfis »

sliptonic wrote: Thu Jun 30, 2022 9:23 pm Hmm. I'm not sure how to do this so it works with appimages.

The nature of the integration works in two ways. It uses a new python library. It also lets the user launch the full application with a project file created by Path.

I'm testing whether the camotics application is installed with

Code: Select all

subprocess.run(["camotics", "--version"])
That returns the version of the installed application. On my linux box the binary is /usr/bin/camotics. Based on that, I'm assuming the python library is also available and in the python path.

If I import the python library and check the file path:

Code: Select all

>>> import camotics
>>> camotics.__file__
'/usr/lib/python3/dist-packages/camotics.so'
:)
Everything is not what it seems :)

Code: Select all

pacman -Qs camotics
local/camotics-git r960.6942bd0-1
    3-axis NC machining simulation software
    
    
find / -name camotics.so
mkdir /usr/lib/python3/dist-packages

/home/user/.cache/pikaur/build/camotics-git/src/camotics/build/camotics.so
ln -s /home/user/.cache/pikaur/build/camotics-git/src/camotics/build/camotics.so /usr/lib/python3/dist-packages/


Important - in my system, Arch, versions of python have directories for each version,

ll /usr/lib/python
python2.7/ python3/ python3.10/ python3.8/

So if you were looking for a library in python3, I created this directory, along with the necessary nested one. And it still doesn't detect it.
memfis
Posts: 377
Joined: Tue Nov 15, 2016 7:58 pm

Re: No module named 'camotics'

Post by memfis »

I think we should take the quick and easy way - to specify the path to the desired file directly in Preferences
Снимок экрана от 2022-07-01 12-13-04.jpg
Снимок экрана от 2022-07-01 12-13-04.jpg (209.99 KiB) Viewed 405 times
User avatar
sliptonic
Veteran
Posts: 2962
Joined: Tue Oct 25, 2011 10:46 pm
Location: Columbia, Missouri
Contact:

Re: No module named 'camotics'

Post by sliptonic »

memfis wrote: Fri Jul 01, 2022 9:12 am I think we should take the quick and easy way - to specify the path to the desired file directly in Preferences
Снимок экрана от 2022-07-01 12-13-04.jpg
If the problem is locating the binary executable, then maybe. If it's the location of the python library, then it seems like the system is broken. The assumption on any python import is that the library is in the PYTHONPATH.
Post Reply