ModuleNotFoundError: No module named encodings
  • 09-May-2023
Lightrun Team
Author Lightrun Team
ModuleNotFoundError: No module named encodings

ModuleNotFoundError: No module named ‘encodings’

Lightrun Team
Lightrun Team

Explanation of the problem

When attempting to start Mariner on a DietPi system, the program fails to launch. Specifically, the following error message is displayed when attempting to manually start the program using the command “sudo -u mariner mariner”: “Could not find platform independent libraries <prefix>. Could not find platform dependent libraries <exec_prefix>. Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]. Fatal Python error: initfsencoding: Unable to get the locale encoding. ModuleNotFoundError: No module named ‘encodings’.”

Troubleshooting with the Lightrun Developer Observability Platform

Getting a sense of what’s actually happening inside a live application is a frustrating experience, one that relies mostly on querying and observing whatever logs were written during development.
Lightrun is a Developer Observability Platform, allowing developers to add telemetry to live applications in real-time, on-demand, and right from the IDE.

  • Instantly add logs to, set metrics in, and take snapshots of live applications
  • Insights delivered straight to your IDE or CLI
  • Works where you do: dev, QA, staging, CI/CD, and production

Start for free today

Problem solution for ModuleNotFoundError: No module named ‘encodings’

Mariner users on DietPi are facing a problem where Mariner cannot be started, and it throws an error related to Python. The error message indicates that some platform-independent and platform-dependent libraries cannot be found. This issue occurs because Mariner requires a specific version of Python that is not available on DietPi by default. As a result, the solution suggested by some users is to copy the required version of Python to the Mariner directory, copy some necessary files from an older version of Python to the newer version, and edit the post-installation script to make it work. However, this solution may not be the best approach as it can cause issues with installing other software relying on Python 3.9.

An alternative solution is to use pyenv, a Python version management tool that allows users to install and switch between different versions of Python. This solution involves installing pyenv on the DietPi system, then using it to install the required version of Python for Mariner. Once the correct version of Python is installed, Mariner can be installed and configured to use the specific version of Python installed by pyenv. This approach ensures that the required version of Python is available for Mariner without causing potential issues with other software installations.

In conclusion, Mariner users facing issues with starting Mariner on DietPi due to Python-related errors can choose between two solutions. One solution involves copying the required version of Python to the Mariner directory, copying some necessary files, and editing the post-installation script, which may cause potential issues with other software installations. Alternatively, using pyenv to manage Python versions can provide a more robust solution, enabling the installation of the specific version of Python required by Mariner without any adverse effects on other software installations.

Other popular problems with mariner

Problem: Mariner not starting on DietPi Description

Mariner fails to start on DietPi, and the following error is displayed: “Fatal Python error: initfsencoding: Unable to get the locale encoding ModuleNotFoundError: No module named ‘encodings’.” This error indicates a problem with the Python installation, which is a dependency of Mariner.


One possible solution is to copy the Python 3.9 installation to the Mariner directory, and copy some files from Python 3.7 to Python 3.9. The next step is to edit the post-install script, adding Python 3.9 version to the script. Once this is done, the post-install script must be relaunched to configure the changes. However, it is important to note that this solution may cause issues when installing other software that relies on Python 3.9. Therefore, a more comprehensive solution involving pyenv may be a better approach.

Problem: Unexpected Printer Response Error Description

The error message “Unexpected Printer Response” is displayed when attempting to start Mariner. This error can occur when the printer is not connected, or there is a problem with the printer’s response.


To resolve this error, ensure that the printer is connected and powered on. Check the connections between the printer and the Raspberry Pi, and ensure that the printer is set up correctly. If the printer is connected and set up correctly, the error may be due to a problem with the printer’s response. To address this, try updating the firmware on the printer, or resetting the printer to its default settings.

Problem: File Upload Error Description

When attempting to upload files to Mariner, the following error is displayed: “Failed to upload file: The server responded with an error.” This error indicates that there is a problem with the file upload process.


To address this error, ensure that the file being uploaded is in a supported format. Mariner supports STL and ZIP files, and other file formats may not be compatible. Additionally, check that the file is not too large, as Mariner has a file size limit of 100 MB. If the file is in the correct format and is not too large, the error may be due to a problem with the network connection. Check the network connection between the Raspberry Pi and the device from which the file is being uploaded, and ensure that the connection is stable and not interrupted.

A brief introduction to mariner

Mariner is an open-source software application designed for managing and controlling 3D printing processes. It is primarily intended for use with resin-based 3D printers, and it offers a range of features to enable users to monitor and control the printing process from a web interface. The software is compatible with a variety of different 3D printers, including the Elegoo Mars, Mars Pro, and Mars 2 Pro.

Mariner is built using the Python programming language and includes a range of libraries and modules to support its functionality. The software includes a web-based user interface that allows users to control their 3D printer and manage the printing process from a remote location. The web interface includes a range of features, including the ability to upload and select 3D models, set print parameters, and monitor the printing process in real-time. Additionally, Mariner includes a command-line interface for advanced users who prefer to work with the software via a terminal window.

Overall, Mariner is a powerful tool for managing and controlling resin-based 3D printers. Its open-source nature and extensive feature set make it a popular choice among 3D printing enthusiasts and professionals alike. With its intuitive web interface and command-line interface, users can easily monitor and control their printing process, making it an essential tool for anyone looking to streamline their 3D printing workflow.

Most popular use cases for mariner

Mariner is a powerful software that can be used to control a wide range of 3D printers. One of the main uses of Mariner is to generate G-code, a programming language used by 3D printers to control their movements and actions. This makes Mariner an ideal tool for users who want to create complex 3D models and print them with precision. The software offers a user-friendly interface that allows users to easily adjust the settings and parameters of their prints, such as print speed, layer thickness, and temperature. Mariner can also be used to perform advanced actions, such as managing multiple printers and creating custom macros and scripts. Overall, Mariner is a versatile software that can be used by both beginners and advanced users to create high-quality 3D prints.

Another use case of Mariner is for users who want to run their 3D printers remotely. Mariner includes a built-in web server that allows users to control their printers from any device with a web browser. This means that users can monitor their prints, adjust the settings, and start and stop prints from anywhere in the world. The web interface is easy to use and provides users with real-time feedback about the status of their prints. Mariner also supports a wide range of 3D printer models, making it an ideal tool for users who own multiple printers and want to manage them all from a single interface.

Finally, Mariner can be used for automation and scripting tasks. The software includes a powerful Python API that allows users to write custom scripts and macros to automate their 3D printing workflows. For example, users can write a script to automatically slice and print a 3D model when a specific file is added to a designated folder. The Python API provides access to all of the features of Mariner, including the G-code generator, printer control, and web interface. This allows users to create highly customized and automated 3D printing workflows that can save time and increase productivity.


It’s Really not that Complicated.

You can actually understand what’s going on inside your live applications.

Try Lightrun’s Playground

Lets Talk!

Looking for more information about Lightrun and debugging?
We’d love to hear from you!
Drop us a line and we’ll get back to you shortly.

By submitting this form, I agree to Lightrun’s Privacy Policy and Terms of Use.