pythonocc-core icon indicating copy to clipboard operation
pythonocc-core copied to clipboard

Problem importing from OCC.Extend and OCC.Display

Open ghost opened this issue 5 years ago • 6 comments

Hi there! I am working with python 3.7 and pythonocc-core 7.4.0 and I am trying to import these methods:

  • from OCC.Extend.DataExchange import write_step_file
  • from OCC.Display.SimpleGui import init_display The thing is that I can import anything that comes from OCC.Core but not from OCC.Extend or OCC.Display and I don't know if I am doing something wrong.

The error when I am trying to import the method write_step_file is the following one:

Traceback (most recent call last):
  File "/mnt/d/Documents/workspace/prueba/step_to_stl_prueba.py", line 10, in <module>
    from OCC.Extend.DataExchange import write_step_file
  File "/root/miniconda3/envs/condaPrueba/lib/python3.7/site-packages/OCC/Extend/DataExchange.py", line 32, in <module>
    from OCC.Core.XCAFDoc import (XCAFDoc_DocumentTool_ShapeTool,
  File "/root/miniconda3/envs/condaPrueba/lib/python3.7/site-packages/OCC/Core/XCAFDoc.py", line 18, in <module>
    from . import _XCAFDoc
ImportError: libGL.so.1: cannot open shared object file: No such file or directory

And the error when I try to import the method init_display from SimpleGui is the next one:

_Traceback (most recent call last):
  File "/mnt/d/Documents/workspace/prueba/coreLoadIges.py", line 7, in <module>
    from OCC.Display.SimpleGui import init_display
  File "/root/miniconda3/envs/condaPrueba/lib/python3.7/site-packages/OCC/Display/SimpleGui.py", line 26, in <module>
    from OCC.Display.OCCViewer import OffscreenRenderer
  File "/root/miniconda3/envs/condaPrueba/lib/python3.7/site-packages/OCC/Display/OCCViewer.py", line 28, in <module>
    from OCC.Core.Aspect import Aspect_GFM_VER
  File "/root/miniconda3/envs/condaPrueba/lib/python3.7/site-packages/OCC/Core/Aspect.py", line 18, in <module>
    from . import _Aspect
ImportError: libGL.so.1: cannot open shared object file: No such file or directory_

Thank you for your help!

ghost avatar Mar 18 '20 17:03 ghost

This looks like an installation issue. Can you try to create another conda environment?

jf--- avatar Mar 19 '20 11:03 jf---

It seems that your OpenGL installation is wrong. What's your machine configuration ? os ? version ?

tpaviot avatar Mar 25 '20 14:03 tpaviot

I am getting the same error:

Traceback (most recent call last):
  File "c:/Users/91917/Desktop/OpenCASCADE/main.py", line 9, in <module>
    import OCC.Display.qtDisplay as qtDisplay
  File "E:\ProgramData\Anaconda3\envs\occenv1\lib\site-packages\OCC\Display\qtDisplay.py", line 25, in <module>
    from OCC.Display import OCCViewer
  File "E:\ProgramData\Anaconda3\envs\occenv1\lib\site-packages\OCC\Display\OCCViewer.py", line 27, in <module>
    from OCC.Core.Aspect import Aspect_GFM_VER
  File "E:\ProgramData\Anaconda3\envs\occenv1\lib\site-packages\OCC\Core\Aspect.py", line 18, in <module>
    from . import _Aspect
ImportError: DLL load failed while importing _Aspect: The specified module could not be found.

This one is in the fresh environment. My OS is Win10 with Intel HD graphics 620. Version of pythonocc-core is 7.5.1.

Please tell me how to rectify it.

lokit-iscitech avatar Aug 10 '21 09:08 lokit-iscitech

My conda env in windows, python 3.10, pythonocc-core==7.5.1 caused the same problem. Installing libdeflate and renaming env/Library/bin/deflate.dll to libdeflate.dll solved it in my case. Cheking DLL dependencies by dependencies hepled a lot.

moker-spaghetti avatar Dec 05 '23 15:12 moker-spaghetti

Hi, I tried the PythonOcc beginners example from the analysis Situs forum but I keep encountering this errror PythonOcc issue Can someone please help

Nadjei74 avatar Apr 04 '24 01:04 Nadjei74