Pythonocc-nodes-for-Ryven icon indicating copy to clipboard operation
Pythonocc-nodes-for-Ryven copied to clipboard

Ryven | Load Example | demo_example.json can't find PythonOCC

Open WillAdams opened this issue 3 years ago • 15 comments

Click on "AUTO IMPORT" and it finds std but can't find PythonOCC

WillAdams avatar Jan 17 '22 20:01 WillAdams

yes, it doesn't know where the nodes package is, because when the creator of the project used it on his machine, it was under a different path. you need to locate it manually: click on ADD, navigate to your clone of this repo and select Pythonocc-nodes-for-Ryven/PythonOCC/nodes.py. If you then save the project on your machine it will update the paths in the project file and you don't have to locate it again next time

leon-thomm avatar Jan 17 '22 21:01 leon-thomm

I don't understand "clone of this repo"?

Wasn't it installed by the command "conda install -c conda-forge pythonocc-core"?

WillAdams avatar Jan 17 '22 23:01 WillAdams

pythonocc-core is a prerequisite (or dependency), along with pythonocc-utils, anaconda, and ryven. if you want to use this project (Pythonocc-nodes-for-Ryven), you have to download it too, i.e. clone the repository via git clone https://github.com/Tanneguydv/Pythonocc-nodes-for-Ryven

leon-thomm avatar Jan 18 '22 06:01 leon-thomm

I guess the thing which I'm missing here is the difference between just using python at the terminal, using anaconda, and the difference in accessing one or the other.

Is there a set of step-by-step instructions, which assume nothing, for installing on Linux?

What happened to the pythonocc.org website?

WillAdams avatar Jan 18 '22 13:01 WillAdams

yeah, I don't know if there are more detailed instructions for PythonOCC, but you will find plenty of resources online which take you through the process of installing the Anaconda platform, setting up a new conda environment, and then installing packages in this environment, which is what you need.

leon-thomm avatar Jan 18 '22 14:01 leon-thomm

and to prevent confusion: you can have (and usually do have) various Python installations on your system, and Anaconda will also bring its own Python installation. So, yes when using PythonOCC you are using Python, but you use it inside an Anaconda environment

leon-thomm avatar Jan 18 '22 14:01 leon-thomm

Once everything installed you can create a .bat file with this text :

call activate pyoccryv3env
ryven
pause

where pyoccryv3env is the virtual environment you have setup to run Ryven with PythonOCC Then create a shortcut of this .bat file to havae easy access to Ryven.

Personnaly I use Miniconda instead of Anaconda, and I use Pycharm to easily access virtual environnement and code in a python friendly IDE

You can find all ressources on PythonOCC from this link :https://github.com/tpaviot/pythonocc-core

Tanneguydv avatar Jan 18 '22 14:01 Tanneguydv

The problem seems to be that I can't get a working nodes.py loaded.

I've downloaded and unzipped: https://github.com/Tanneguydv/Pythonocc-nodes-for-Ryven/archive/refs/heads/main.zip

and if I point it at:

image

it won't press

and if I point it at:

image

get:

image

and if both:

image

(base) C:\Users\willa>ryven importing packages... Traceback (most recent call last): File "C:\Users\willa\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Users\willa\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in run_code exec(code, run_globals) File "C:\Users\willa\AppData\Local\Programs\Python\Python310\Scripts\ryven.exe_main.py", line 7, in File "C:\Users\willa\AppData\Local\Programs\Python\Python310\lib\site-packages\ryven\main\Ryven.py", line 75, in run editor = MainWindow(editor_init_config, window_title, window_theme, flow_theme, parent=gui_parent) File "C:\Users\willa\AppData\Local\Programs\Python\Python310\lib\site-packages\ryven\gui\main_window.py", line 77, in init self.import_packages(config['required packages']) File "C:\Users\willa\AppData\Local\Programs\Python\Python310\lib\site-packages\ryven\gui\main_window.py", line 324, in import_packages self.import_nodes(p) File "C:\Users\willa\AppData\Local\Programs\Python\Python310\lib\site-packages\ryven\gui\main_window.py", line 334, in import_nodes nodes = import_nodes_package(p) File "C:\Users\willa\AppData\Local\Programs\Python\Python310\lib\site-packages\ryven\main\utils.py", line 48, in import_nodes_package load_from_file(package.file_path) File "C:\Users\willa\AppData\Local\Programs\Python\Python310\lib\site-packages\ryven\main\utils.py", line 19, in load_from_file mod = spec.loader.load_module(name) File "", line 548, in _check_name_wrapper File "", line 1063, in load_module File "", line 888, in load_module File "", line 287, in _load_module_shim File "", line 619, in _exec File "", line 883, in exec_module File "", line 241, in _call_with_frames_removed File "C:\Users\willa\Desktop\Xtensions\Pythonocc-nodes-for-Ryven-main\nodes.py", line 3, in widgets = import_widgets(file) File "C:\Users\willa\AppData\Local\Programs\Python\Python310\lib\site-packages\ryven\NENV.py", line 81, in import_widgets load_from_file(abs_path) File "C:\Users\willa\AppData\Local\Programs\Python\Python310\lib\site-packages\ryven\main\utils.py", line 19, in load_from_file mod = spec.loader.load_module(name) File "", line 548, in _check_name_wrapper File "", line 1063, in load_module File "", line 888, in load_module File "", line 287, in _load_module_shim File "", line 619, in _exec File "", line 879, in exec_module File "", line 1016, in get_code File "", line 1073, in get_data FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\willa\Desktop\Xtensions\Pythonocc-nodes-for-Ryven-main\widgets.py'

WillAdams avatar Feb 02 '22 01:02 WillAdams

I think that your installation of Ryven does not belong to the virtual environment created with OCC installation, that's why the module OCC can't be found while launching Ryven I guess. At the installation of OCC you created a virtual env (named such as pyoccenv), you have to install Ryven in this same virtual environment (conda activate pyoccenv then pip install ryven)

Tanneguydv avatar Feb 02 '22 08:02 Tanneguydv

@Tanneguydv what is the difference between the two nodes files? there should only be one in PythonOCC/

leon-thomm avatar Feb 02 '22 11:02 leon-thomm

There's only one node file, no?

Tanneguydv avatar Feb 02 '22 11:02 Tanneguydv

repo/nodes.py https://github.com/Tanneguydv/Pythonocc-nodes-for-Ryven/blob/main/nodes.py repo/PythonOCC/nodes.py https://github.com/Tanneguydv/Pythonocc-nodes-for-Ryven/blob/main/PythonOCC/nodes.py which caused some confusion above, there should only be 1, the files are identical

#14

leon-thomm avatar Feb 02 '22 11:02 leon-thomm

My Bad, I'll fix this

Tanneguydv avatar Feb 02 '22 11:02 Tanneguydv

removed, I closed your pull request, thank you!

Tanneguydv avatar Feb 02 '22 11:02 Tanneguydv

Okay, the command:

source activate pyoccenv

from: https://github.com/tpaviot/pythonocc-core doesn't seem to work --- instead used:

conda activate pyoccenv

Also, python can't equal 3.10

WillAdams avatar Feb 03 '22 01:02 WillAdams