Skip to content

import cloudComPy as cc is not working standalone in the spyder console #80

Closed

Description

@loosgagnet

@prascle
Hi,

I tried to install cloudComPy using the binaries (version CloudComPy310_20221122) and Anaconda3 (python 3.10.8) on Windows 10. I followed all steps, as you mentioned in GitHub. When I run the following codes in Anacona prompt, everything is fine. "CloudComPy_Test" is the location of binaries.

In Anacona prompt, I run:
cd C:\Users\my\CloudComPy_Test
conda activate CloudComPy310
envCloudComPy.bat

The output is :
Checking environment, Python test: import cloudComPy
Environment OK!

even if I run python in Anacona prompt and then run import cloudComPy as cc, it seems that everything's fine :
(CloudComPy310) C:\Users\my\CloudComPy_Test>python
Python 3.10.8 | packaged by conda-forge | (main, Nov 22 2022, 08:16:53) [MSC v.1929 64 bit (AMD64)] on win32
import cloudComPy as cc
QFileSystemWatcher: Removable drive notification will not work if there is no QCoreApplication instance.
JsonRPCPlugin::JsonRPCPlugin

But when I open spyder using the Anacona prompt, and run import cloudComPy as cc I'm getting the following error:

import cloudComPy as cc
Traceback (most recent call last):
File "C:\Users\my\AppData\Local\Temp\ipykernel_19156\430461993.py", line 1, in <cell line: 1>
import cloudComPy as cc
File "C:\Users\my\CloudComPy_Test\CloudCompare\cloudComPy_init
.py", line 34, in
from _cloudComPy import *
ImportError: DLL load failed while importing cloudComPy: The specified procedure was not found.

I don't know if the problem is with the path or not. But if it is, which path?
When I run the following command in spyder, again it seems that it's running fine:

import os
os.system("envCloudComPy.bat")

Out[1]: 0
Checking environment, Python test: import cloudComPy
Environment OK!

I also checked the PATH and PYTHONPATH using echo in both Anaconda prompt and spyder console, seems both are the same.

in Anaconda prompt:

echo %PATH%

C:\Users\my\anaconda3\envs\CloudComPy310;C:\Users\my\anaconda3\envs\CloudComPy310\Library\mingw-w64\bin;C:\Users\my\anaconda3\envs\CloudComPy310\Library\usr\bin;C:\Users\my\anaconda3\envs\CloudComPy310\Library\bin;C:\Users\my\anaconda3\envs\CloudComPy310\Scripts;C:\Users\my\anaconda3\envs\CloudComPy310\bin;C:\Users\my\anaconda3\condabin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Users\my\anaconda3;C:\Users\my\anaconda3\Library\mingw-w64\bin;C:\Users\my\anaconda3\Library\usr\bin;C:\Users\my\anaconda3\Library\bin;C:\Users\my\anaconda3\Scripts;C:\Users\my\AppData\Local\Microsoft\WindowsApps;C:\FFmpeg\bin;.

envCloudComPy.bat
echo %PATH%

C:\Users\my\CloudComPy_Test\CloudCompare\plugins;C:\Users\my\CloudComPy_Test\CloudCompare;C:\Users\my\CloudComPy_Test\ccViewer;C:\Users\my\CloudComPy_Test;C:\Users\my\anaconda3\envs\CloudComPy310;C:\Users\my\anaconda3\envs\CloudComPy310\Library\mingw-w64\bin;C:\Users\my\anaconda3\envs\CloudComPy310\Library\usr\bin;C:\Users\my\anaconda3\envs\CloudComPy310\Library\bin;C:\Users\my\anaconda3\envs\CloudComPy310\Scripts;C:\Users\my\anaconda3\envs\CloudComPy310\bin;C:\Users\my\anaconda3\condabin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Users\my\anaconda3;C:\Users\my\anaconda3\Library\mingw-w64\bin;C:\Users\my\anaconda3\Library\usr\bin;C:\Users\my\anaconda3\Library\bin;C:\Users\my\anaconda3\Scripts;C:\Users\my\AppData\Local\Microsoft\WindowsApps;C:\FFmpeg\bin;.

echo %PYTHONPATH%

C:\Users\my\CloudComPy_Test\doc\PythonAPI_test;C:\Users\my\CloudComPy_Test\CloudCompare;C:\Users\my\CloudComPy310\CloudCompare;C:\Users\my\CloudComPy310\doc\PythonAPI_test;C:\Users\my\CloudComPy310\doc\PythonAPI_test;C:\Users\my\CloudComPy310\CloudCompare;

in spyder console:

echo %PATH%

C:\Users\my\anaconda3\envs\CloudComPy310;C:\Users\my\anaconda3\envs\CloudComPy310\Library\mingw-w64\bin;C:\Users\my\anaconda3\envs\CloudComPy310\Library\usr\bin;C:\Users\my\anaconda3\envs\CloudComPy310\Library\bin;C:\Users\my\anaconda3\envs\CloudComPy310\Scripts;C:\Users\my\anaconda3\envs\CloudComPy310\bin;C:\Users\my\anaconda3\condabin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Users\my\anaconda3;C:\Users\my\anaconda3\Library\mingw-w64\bin;C:\Users\my\anaconda3\Library\usr\bin;C:\Users\my\anaconda3\Library\bin;C:\Users\my\anaconda3\Scripts;C:\Users\my\AppData\Local\Microsoft\WindowsApps;C:\FFmpeg\bin;.

import os
os.system("envCloudComPy.bat")
echo %PATH%

C:\Users\my\anaconda3\envs\CloudComPy310;C:\Users\my\anaconda3\envs\CloudComPy310\Library\mingw-w64\bin;C:\Users\my\anaconda3\envs\CloudComPy310\Library\usr\bin;C:\Users\my\anaconda3\envs\CloudComPy310\Library\bin;C:\Users\my\anaconda3\envs\CloudComPy310\Scripts;C:\Users\my\anaconda3\envs\CloudComPy310\bin;C:\Users\my\anaconda3\condabin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Users\my\anaconda3;C:\Users\my\anaconda3\Library\mingw-w64\bin;C:\Users\my\anaconda3\Library\usr\bin;C:\Users\my\anaconda3\Library\bin;C:\Users\my\anaconda3\Scripts;C:\Users\my\AppData\Local\Microsoft\WindowsApps;C:\FFmpeg\bin;.

echo %PYTHONPATH%
C:\Users\my\CloudComPy310\doc\PythonAPI_test;C:\Users\my\CloudComPy310\CloudCompare

Could you please check the error of import cloudComPy as cc in the spyder console?
If I need to provide more information, please let me know.

Thanks in advance.

Activity

  1. prascle commented on Dec 20, 2022

    @prascle
    Collaborator

    Hello,

    With Spyder, the only way I have found to set the correct PYTHONPATH is to use the Tools / PYTHONPATH manager menu
    to add .../CloudComPy310/CloudCompare and .../CloudComPy310/doc/PythonAPI_test.
    If I remove these paths in Tools / PYTHONPATH manager, I reproduce the behavior you observe.

    I already added a note about this here, but let me know if there is a better place to give this info.

    I hope this solves your problem.
    Paul

  2. loosgagnet commented on Dec 20, 2022

    @loosgagnet
    Author

    @prascle

    Hi,
    Thanks for the quick comment.

    I already set PYTHONPATH in spyder, sorry I forgot to include it in the first comment. But I still have the same problem. Please see the figure:

    image

    Thanks in advance

  3. loosgagnet commented on Dec 20, 2022

    @loosgagnet
    Author

    @prascle

    I think I solved it. I don't know the reason but after searching I found a suggestion on GitHub spyder-ide/spyder#19220
    I removed the Anaconda related paths from the Path environment variable and this solved the issue.

    image

    Anyway thanks for your time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions