1

I am trying to make Pymses work on my computer for a bachelor thesis. I began by installing Anaconda the way it is described on the website and added the following to my .bashrc file:

export PATH="/users/<name>/anaconda3/bin:$PATH"

Moreover, I added the wxPython module since it was recommended for Pymses. Afterwards, I followed the Pymses documentation to install it by using the "make"-command in the Pymses folder and added the following two lines to my .bashrc file>

export PYTHONPATH=$PYTHONPATH:/users/<name>/pymses
export PATH=$PATH:~/pymses/bin

Now, when I open Python via console and enter "import pymses", I get the following error:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/users/<name>/pymses/pymses/__init__.py", line 21, in <module>
from sources.ramses.output import RamsesOutput
ModuleNotFoundError: No module named 'sources'

The same happens when I enter "make test" while in the Pymses folder:

nosetests -v -w pymses
Failure: ModuleNotFoundError (No module named 'sources') ... ERROR

======================================================================
ERROR: Failure: ModuleNotFoundError (No module named 'sources')
----------------------------------------------------------------------
Traceback (most recent call last):
File "/users/<name>/anaconda3/lib/python3.6/site-packages/nose/failure.py", line 39, in runTest
raise self.exc_val.with_traceback(self.tb)
File "/users/<name>/anaconda3/lib/python3.6/site-packages/nose/loader.py", line 417, in loadTestsFromName
addr.filename, addr.module)
File "/users/<name>/anaconda3/lib/python3.6/site-packages/nose/importer.py", line 47, in importFromPath
return self.importFromDir(dir_path, fqname)
File "/users/<name>/anaconda3/lib/python3.6/site-packages/nose/importer.py", line 94, in importFromDir
mod = load_module(part_fqname, fh, filename, desc)
File "/users/<name>/anaconda3/lib/python3.6/imp.py", line 245, in load_module
return load_package(name, filename)
File "/users/<name>/anaconda3/lib/python3.6/imp.py", line 217, in load_package
return _load(spec)
File "<frozen importlib._bootstrap>", line 684, in _load
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/users/<name>/pymses/pymses/__init__.py", line 21, in <module>
from sources.ramses.output import RamsesOutput
ModuleNotFoundError: No module named 'sources'

----------------------------------------------------------------------
Ran 1 test in 0.003s

FAILED (errors=1)
Makefile:21: recipe for target 'test' failed
make: *** [test] Error 1

Part of the issue is that I haven't worked with Python for a long time, so I don't really have an idea of where to start, bear that in mind please. I looked up the file 'pymses/pymses/init.py' (with two underscores before and after init instead of init being bold) and found the following code:

from sources.ramses.output import RamsesOutput
import sources
import filters

'Sources' is a folder in the same directory/folder as that file, 'ramses' is a folder within 'sources' and 'output.py' is a python file within 'ramses'.

I don't have any idea of what the issue is. Any ideas?

e: In the "sources" directory, there is another init file containing the following code:

r"""
:mod:`pymses.sources` --- Source file formats package
=====================================================

"""
import ramses
import hop

__all__ = ["ramses", "hop"]

e2: For completion, there is also a init file within the ramses directory, which contains the following code:

r"""
:mod:`pymses.sources.ramses` --- RAMSES file formats package
************************************************************

"""
from output import *
from octree import CameraOctreeDatasource, CameraOctreeDataset
import hilbert
import tree_utils
import filename_utils

__all__ = ["hilbert", "tree_utils", "filename_utils", "CameraOctreeDatasource", "CameraOctreeDataset"]
__all__.extend(output.__all__)

For clarification, the structure is the following (directories being denoted by '):

  • 'name'
    • 'pymses'
      • makefile
      • setup.py
      • 'pymses'
        • init.py
        • 'sources'
          • 'hop'
          • init.py
          • 'ramses'
            • output.py
            • init.py
            • other files
        • other directories
      • other directories and files I can add if helpful
DominikR
  • 59
  • 1
  • 10
  • I know link answers aren't good, but you might find this useful: https://askubuntu.com/a/471168/547235 – Gerik Jul 03 '18 at 12:51
  • It is useful for clarification, thanks for that. But it doesn't solve my issue, at least not as far as I can see. – DominikR Jul 04 '18 at 10:08

2 Answers2

0

Just open a terminal and do

pip install sources
Sylvan LE DEUNFF
  • 682
  • 1
  • 6
  • 21
  • Didn't work. I entered that command, to which the terminal responded (amongst other things) "Successfully built sources | distributed 1.21.8 requires msgpack, which is not installed. | Installing collected packages: sources | Successfully installed sources-1.1.0 " Then I installed msgpack according to this link https://stackoverflow.com/questions/51050257/distributed-1-21-8-requires-msgpack-which-is-not-installed and entered your command again, to which the terminal replied that sources is already installed. So I tried 'make test' again, but the result doesn't change from earlier. – DominikR Jul 04 '18 at 09:44
0

Try to add __init__.py file in the source folder.

Go to your source directory, execute $ touch __init__.py command.

rishi kant
  • 1,235
  • 1
  • 9
  • 28