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)?


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 :
       virtual packages : __osx=10.16=0
       base environment : /Users/myusername/opt/anaconda3  (writable)
      conda av data dir : /Users/myusername/opt/anaconda3/etc/conda
  conda av metadata url : None
           channel URLs :
          package cache : /Users/myusername/opt/anaconda3/pkgs
       envs directories : /Users/myusername/opt/anaconda3/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


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