Problems with pylith installation in Ubuntu 18.04LTS of Win10 subsystem

I am trying to insall pylith in my ubuntu,but it doesn’t work.

xuran@LAPTOP-MVOJ75MD:/mnt/d/pylith/pylith-2.2.2-linux-x86_64$ source setup.sh
Ready to run PyLith.
xuran@LAPTOP-MVOJ75MD:/mnt/d/pylith/pylith-2.2.2-linux-x86_64$ pylith
Traceback (most recent call last):
File “/mnt/d/pylith/pylith-2.2.2-linux-x86_64/bin/pylith”, line 25, in
from pylith.apps.PyLithApp import PyLithApp
File “/mnt/d/pylith/pylith-2.2.2-linux-x86_64/lib/python2.7/site-packages/pylith/apps/PyLithApp.py”, line 23, in
from PetscApplication import PetscApplication
File “/mnt/d/pylith/pylith-2.2.2-linux-x86_64/lib/python2.7/site-packages/pylith/apps/PetscApplication.py”, line 24, in
from mpi import Application
File “/mnt/d/pylith/pylith-2.2.2-linux-x86_64/lib/python2.7/site-packages/pythia-0.8.1.19-py2.7.egg/mpi/init.py”, line 15, in
from Application import Application
File “/mnt/d/pylith/pylith-2.2.2-linux-x86_64/lib/python2.7/site-packages/pythia-0.8.1.19-py2.7.egg/mpi/Application.py”, line 14, in
from pyre.applications.Script import Script
File “/mnt/d/pylith/pylith-2.2.2-linux-x86_64/lib/python2.7/site-packages/pythia-0.8.1.19-py2.7.egg/pyre/applications/init.py”, line 19, in
from Shell import Shell
File “/mnt/d/pylith/pylith-2.2.2-linux-x86_64/lib/python2.7/site-packages/pythia-0.8.1.19-py2.7.egg/pyre/applications/Shell.py”, line 25, in
class Shell(Configurable):
File “/mnt/d/pylith/pylith-2.2.2-linux-x86_64/lib/python2.7/site-packages/pythia-0.8.1.19-py2.7.egg/pyre/applications/Shell.py”, line 36, in Shell
journal = journal.facility()
File “/mnt/d/pylith/pylith-2.2.2-linux-x86_64/lib/python2.7/site-packages/pythia-0.8.1.19-py2.7.egg/journal/init.py”, line 30, in facility
return JournalFacility(default)
File “/mnt/d/pylith/pylith-2.2.2-linux-x86_64/lib/python2.7/site-packages/pythia-0.8.1.19-py2.7.egg/journal/components/JournalFacility.py”, line 24, in init
from Journal import Journal as factory
File “/mnt/d/pylith/pylith-2.2.2-linux-x86_64/lib/python2.7/site-packages/pythia-0.8.1.19-py2.7.egg/journal/components/Journal.py”, line 18, in
class Journal(Component):
File “/mnt/d/pylith/pylith-2.2.2-linux-x86_64/lib/python2.7/site-packages/pythia-0.8.1.19-py2.7.egg/journal/components/Journal.py”, line 21, in Journal
class Inventory(Component.Inventory):
File “/mnt/d/pylith/pylith-2.2.2-linux-x86_64/lib/python2.7/site-packages/pythia-0.8.1.19-py2.7.egg/journal/components/Journal.py”, line 27, in Inventory
error = ChannelFacility(“error”)
File “/mnt/d/pylith/pylith-2.2.2-linux-x86_64/lib/python2.7/site-packages/pythia-0.8.1.19-py2.7.egg/journal/components/ChannelFacility.py”, line 21, in init
from Channel import Channel
File “/mnt/d/pylith/pylith-2.2.2-linux-x86_64/lib/python2.7/site-packages/pythia-0.8.1.19-py2.7.egg/journal/components/Channel.py”, line 14, in
import journal
File “/mnt/d/pylith/pylith-2.2.2-linux-x86_64/lib/python2.7/site-packages/pythia-0.8.1.19-py2.7.egg/journal/components/journal.py”, line 18, in
class Journal(Component):
File “/mnt/d/pylith/pylith-2.2.2-linux-x86_64/lib/python2.7/site-packages/pythia-0.8.1.19-py2.7.egg/journal/components/journal.py”, line 21, in Journal
class Inventory(Component.Inventory):
File “/mnt/d/pylith/pylith-2.2.2-linux-x86_64/lib/python2.7/site-packages/pythia-0.8.1.19-py2.7.egg/journal/components/journal.py”, line 27, in Inventory
error = ChannelFacility(“error”)
File “/mnt/d/pylith/pylith-2.2.2-linux-x86_64/lib/python2.7/site-packages/pythia-0.8.1.19-py2.7.egg/journal/components/ChannelFacility.py”, line 21, in init
from Channel import Channel
ImportError: cannot import name Channel

Do you have the file:
“/mnt/d/pylith/pylith-2.2.2-linux-x86_64/lib/python2.7/site-packages/pythia-0.8.1.19-py2.7.egg/journal/components/Channel.py"

If so, in that file there should also be the line:

class Channel(Component):

If both of those are true, what is the output of:

echo $PYTHONPATH

There are both exist in my file.when I open a terminal , enter echo $PYTHONPATH and nothing will happen.

Did you do echo $PYTHONPATH and echo $PATH after doing source setup.sh? You must run source setup.sh every time you want to use PyLith unless you manually add the corresponding environment variables to your shell setup.

My guess is that there is a conflict between Channel from Pyre (installed with PyLith) and some other Python package on your system. These can be the most difficult issues to debug because we have no idea what other software is on your system. Since from Channel import Channel is what is failing, that is the place to start debugging. After you run source setup.sh, try starting Python and then importing Channel by running the following:

python
>>> from journal.components.Channel import Channel
>>> dir(Channel)
# The output should be
['ConfigurableClass', 'Inventory', '__class__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__getstate__', '__hash__', '__init__', '__metaclass__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setstate__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_configure', '_defaults', '_fini', '_init', '_listing', '_showHelp', '_validate', 'applyConfiguration', 'collectDefaults', 'components', 'configureComponent', 'configureComponents', 'configureProperties', 'createInventory', 'createMetaInventory', 'createRegistry', 'facilities', 'filterConfiguration', 'fini', 'getCurator', 'getDepositories', 'getLocator', 'getTraitDescriptor', 'getTraitValue', 'getVault', 'init', 'initializeConfiguration', 'loadConfiguration', 'newConfigContext', 'properties', 'retrieveComponent', 'retrieveConfiguration', 'retrieveObject', 'retrieveTemplate', 'setCurator', 'setLocator', 'setVault', 'showComponents', 'showCurator', 'showHelp', 'showProperties', 'showUsage', 'updateConfiguration']

Thank you . After reinstalling the system, it has been successfully installed.

I’m a beginner of pylith and I meet the same problem. The version is 2.2.2.
When I input “from journal.components.Channel import Channel”

a@LAPTOP-BJ5PD08B:/mnt/d/pylith-2.2.2/pylith-2.2.2-linux-x86_64$ python
Python 2.7.15 (default, Jul 2 2019, 11:08:31)
[GCC 7.3.0] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.

from journal.components.Channel import Channel
Traceback (most recent call last):
File “”, line 1, in
File “/mnt/d/pylith-2.2.2/pylith-2.2.2-linux-x86_64/lib/python2.7/site-packages/pythia-0.8.1.19-py2.7.egg/journal/components/Channel.py”, line 14, in
import journal
File “/mnt/d/pylith-2.2.2/pylith-2.2.2-linux-x86_64/lib/python2.7/site-packages/pythia-0.8.1.19-py2.7.egg/journal/components/journal.py”, line 18, in
class Journal(Component):
File “/mnt/d/pylith-2.2.2/pylith-2.2.2-linux-x86_64/lib/python2.7/site-packages/pythia-0.8.1.19-py2.7.egg/journal/components/journal.py”, line 21, in Journal
class Inventory(Component.Inventory):
File “/mnt/d/pylith-2.2.2/pylith-2.2.2-linux-x86_64/lib/python2.7/site-packages/pythia-0.8.1.19-py2.7.egg/journal/components/journal.py”, line 27, in Inventory
error = ChannelFacility(“error”)
File “/mnt/d/pylith-2.2.2/pylith-2.2.2-linux-x86_64/lib/python2.7/site-packages/pythia-0.8.1.19-py2.7.egg/journal/components/ChannelFacility.py”, line 21, in init
from Channel import Channel
ImportError: cannot import name Channel

What do I need to do next? I’ll try not to choose reinstalling the operating system as a priority.

As mentioned in the previous responses on this topic, the most likely cause of this error is a conflict with other Python modules on your system.

Before running source setup.sh, make sure your PATH only includes system directories (for example, PATH=/bin:/sbin:/usr/bin:/usr/sbin) and PYTHONPATH is not defined (unset PYTHONPATH).

What Linux distribution and version are you using?

Thank you for your reply!

I successfully installed PyLith-v4.2. But the installation of version 2.2.2 is failed. I’m using Ubuntu 18.04.

I conducted the tests as you suggested, and the output is as follows:

Before running source setup.sh:
a@LAPTOP-BJ5PD08B:/mnt/d/pylith-2.2.2/pylith-2.2.2-linux-x86_64$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/Windows/system32:/mnt/c/Windows:/mnt/c/Windows/System32/Wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0/:/mnt/c/Windows/System32/OpenSSH/:/mnt/c/Program Files/NVIDIA Corporation/NVIDIA app/NvDLISR:/mnt/c/Program Files/dotnet/:/mnt/d/Matlab2024a/runtime/win64:/mnt/d/Matlab2024a/bin:/mnt/d/GMT6.2/gmt6/bin:/mnt/c/Users/Dyrussss/AppData/Local/Microsoft/WindowsApps:/mnt/d/Microsoft VS Code/bin:/snap/bin

a@LAPTOP-BJ5PD08B:/mnt/d/pylith-2.2.2/pylith-2.2.2-linux-x86_64$ echo $PYTHONPATH
no output

After running source setup.sh:
a@LAPTOP-BJ5PD08B:/mnt/d/pylith-2.2.2/pylith-2.2.2-linux-x86_64$ echo $PATH
/mnt/d/pylith-2.2.2/pylith-2.2.2-linux-x86_64/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/Windows/system32:/mnt/c/Windows:/mnt/c/Windows/System32/Wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0/:/mnt/c/Windows/System32/OpenSSH/:/mnt/c/Program Files/NVIDIA Corporation/NVIDIA app/NvDLISR:/mnt/c/Program Files/dotnet/:/mnt/d/Matlab2024a/runtime/win64:/mnt/d/Matlab2024a/bin:/mnt/d/GMT6.2/gmt6/bin:/mnt/c/Users/Dyrussss/AppData/Local/Microsoft/WindowsApps:/mnt/d/Microsoft VS Code/bin:/snap/bin

a@LAPTOP-BJ5PD08B:/mnt/d/pylith-2.2.2/pylith-2.2.2-linux-x86_64$ echo $PYTHONPATH
/mnt/d/pylith-2.2.2/pylith-2.2.2-linux-x86_64/lib/python2.7/site-packages:/mnt/d/pylith-2.2.2/pylith-2.2.2-linux-x86_64/lib64/python2.7/site-packages

Could you help me analyze the source of the conflict? Version 4.2 can run, but version 2.2.2 cannot.

You have a lot of directories in your PATH. I suspect that there is some software in one of those directories that is creating a conflict. I would start by setting your PATH to the bare minimum, like I suggested. You can do this in a terminal shell by setting the PATH environment variable. I am not sure why PyLith v4.2 works and v2.2.2 does not.

PATH=x86_64/bin:/usr/sbin:/usr/bin:/sbin:/bin
source setup.sh

I do recommend updating your operating system as Ubuntu 18.04 is more than 7 years old, and many of the packages are out of date. Ubuntu 24.04 and other long-term releases are good options as most will be fully supported for at least 4 more years.

Thank you!

I’m currently using Ubuntu 24.04 and have set my PATH to the bare minimum as you suggested. However, the installation still was failed. I apologize, as I’m not sure I understood your instructions correctly. Is the problem that my system is Windows 11?

zjz@LAPTOP-BJ5PD08B:/mnt/d/pylith-2.2.2/pylith-2.2.2-linux-x86_64$ PATH=/mnt/d/pylith-2.2.2/pylith-2.2.2-linux-x86_64/bin:/usr/sbin:/usr/bin:/sbin:/bin
zjz@LAPTOP-BJ5PD08B:/mnt/d/pylith-2.2.2/pylith-2.2.2-linux-x86_64$ source setup.sh
Ready to run PyLith.

zjz@LAPTOP-BJ5PD08B:/mnt/d/pylith-2.2.2/pylith-2.2.2-linux-x86_64$ pylith
Traceback (most recent call last):
File “/mnt/d/pylith-2.2.2/pylith-2.2.2-linux-x86_64/bin/pylith”, line 25, in
from pylith.apps.PyLithApp import PyLithApp
File “/mnt/d/pylith-2.2.2/pylith-2.2.2-linux-x86_64/lib/python2.7/site-packages/pylith/apps/PyLithApp.py”, line 23, in

ImportError: cannot import name Channel

Thank you very much for your help! @baagaard

I don’t have access to a computer running Windows, so I am making educated guesses as to the problem.

I cannot reproduce this behavior in a Ubuntu 24.04 Docker container (bare bones image), so the problem is not the Linux distribution. I think it has to be something related to your environment variables. What is the output of running the env command?

PATH=/usr/sbin:/usr/bin:/sbin:/bin
source setup.sh
env