Installation error: No module named compas.__main__

Hi COMPAS developers,

I’m installing COMPAS as newbie.

I installed Anaconda, created as mentioned on your website with Terminal a new environment with conda, installed COMPAS from the package channel conda-forge and activated the environment (named ‘research’). ‘conda list’ shows me that the compas package is in the research environment (version 1.14.0).

However, when running ‘python -m compas’, I receive the following error:
../bin/python: No module named compas.__main__; 'compas' is a package and cannot be directly executed

From what I read, it should not be an issue with PATH, as I installed using ‘conda’?
Any idea how to get it running (although it says to be installed)?
Thanks!

Lars

Specifications: MacOS 12.1 Monterey
When running Conda info in the ‘research’ environment:

 active environment : research
    active env location : /Users/myusername/opt/anaconda3/envs/research
            shell level : 2
       user config file : /Users/myusername/.condarc
 populated config files : /Users/myusername/.condarc
          conda version : 4.11.0
    conda-build version : 3.21.5
         python version : 3.9.7.final.0
       virtual packages : __osx=10.16=0
                          __unix=0=0
                          __archspec=1=x86_64
       base environment : /Users/myusername/opt/anaconda3  (writable)
      conda av data dir : /Users/myusername/opt/anaconda3/etc/conda
  conda av metadata url : None
           channel URLs : https://conda.anaconda.org/conda-forge/osx-64
                          https://conda.anaconda.org/conda-forge/noarch
                          https://repo.anaconda.com/pkgs/main/osx-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/osx-64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /Users/myusername/opt/anaconda3/pkgs
                          /Users/myusername/.conda/pkgs
       envs directories : /Users/myusername/opt/anaconda3/envs
                          /Users/myusername/.conda/envs
               platform : osx-64
             user-agent : conda/4.11.0 requests/2.26.0 CPython/3.9.7 Darwin/21.2.0 OSX/10.16
                UID:GID : 501:20
             netrc file : None
           offline mode : False

I found the solution and it indeed was related with path:
Python searches in different paths. Apparently Python was also looking at a path created several years ago for an old version of compas, which contains erroneous files.

For the newbies, check the paths using:

import sys
sys.path

Best!
Lars

hi lars,

happy to hear the problem is solved :slight_smile:

about the path thing.

a long time a go, adding COMPAS related stuff directly to PATH was indeed part of the setup process. now this is no longer needed. in fact, not even Anaconda should be on PATH as per their own recommendations.

therefore, to prevent potential future errors, i would recommend to remove anything related to Python, and especially COMPAS, from PATH since this now tends to be managed by your terminal or IDE without requiring global changes to the system…

1 Like