Title: [Solved] How can i solve this error "ModuleNotFoundError: No module named 'encodings'" under ubuntu20.04? · pythonnet/pythonnet · Discussion #2147 · GitHub
Open Graph Title: [Solved] How can i solve this error "ModuleNotFoundError: No module named 'encodings'" under ubuntu20.04? · pythonnet/pythonnet · Discussion #2147
X Title: [Solved] How can i solve this error "ModuleNotFoundError: No module named 'encodings'" under ubuntu20.04? · pythonnet/pythonnet · Discussion #2147
Description: [Solved] How can i solve this error "ModuleNotFoundError: No module named 'encodings'" under ubuntu20.04?
Open Graph Description: I want to use Python in a .NET project, and under Windows, I can use Python with the python3.10.dll. Unfortunately, this project needs to run in a Docker container. First, I tried to set up all com...
X Description: I want to use Python in a .NET project, and under Windows, I can use Python with the python3.10.dll. Unfortunately, this project needs to run in a Docker container. First, I tried to set up all com...
Opengraph URL: https://github.com/pythonnet/pythonnet/discussions/2147
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"QAPage","mainEntity":{"@type":"Question","name":"[Solved] How can i solve this error \"ModuleNotFoundError: No module named 'encodings'\" under ubuntu20.04?","text":"I want to use Python in a .NET project, and under Windows, I can use Python with the python3.10.dll. Unfortunately, this project needs to run in a Docker container. First, I tried to set up all components in Ubuntu 20.04, but when I linked the python3.10.so to Runtime.PythonDLL, I got the following error:
\nPython path configuration:
\nPYTHONHOME = '/usr/lib/python3.10/'
\nPYTHONPATH = '/usr/lib/:/usr/lib/python3.10/:/usr/lib/python3.10/encodings/'
\nprogram name = 'python3'
\nisolated = 0
\nenvironment = 1
\nuser site = 1
\nimport site = 1
\nsys._base_executable = '/usr/local/bin/python3'
\nsys.base_prefix = ''
\nsys.base_exec_prefix = ''
\nsys.platlibdir = 'lib'
\nsys.executable = '/usr/local/bin/python3'
\nsys.prefix = ''
\nsys.exec_prefix = ''
\nsys.path = [
\n'/usr/lib/python3.10/;/usr/lib/python3.10/encodings/;/home/ubuntu/python_packages/lib/python3.10/site-packages/;/home/ubuntu/C#Projject/used_python/',
\n]
\nFatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
\nPython runtime state: core initialized
\nModuleNotFoundError: No module named 'encodings'
\nCurrent thread 0x00007f1641311740 (most recent call first):
\n
\nMy guess is that I'm not setting some necessary library, but I don't know which one it is.
","upvoteCount":1,"answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"I could fix it. Unfortunately, under Ubuntu, we cannot use the PYTHONHOME and PYTHONPATH variables. If you use these variables, you will get the \"ModuleNotFoundError: No module named 'encodings'\" error. If you use your own packages, such as creating a class structure and importing it into your project file, you must copy it to the \"dist-packages\" folder.
","upvoteCount":2,"url":"https://github.com/pythonnet/pythonnet/discussions/2147#discussioncomment-5731899"}}}
| route-pattern | /:user_id/:repository/discussions/:number(.:format) |
| route-controller | discussions |
| route-action | show |
| fetch-nonce | v2:a5179670-d4ae-61e5-a063-b7fb62b10800 |
| current-catalog-service-hash | 9f0abe34da433c9b6db74bffa2466494a717b579a96b30a5d252e5090baea7be |
| request-id | 8C96:3DC7AA:34D2E7E:474F8D2:69706EAB |
| html-safe-nonce | d08e24a9b95f8cb5de4ede44e368de851d4e669ed6abaa4e48ed6661ee529764 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4Qzk2OjNEQzdBQTozNEQyRTdFOjQ3NEY4RDI6Njk3MDZFQUIiLCJ2aXNpdG9yX2lkIjoiODM3MzM1NzE2NTYwNjM2Njg5MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 24b0fa5a67dae8eb655dedc7569b9c2a66fcbfc71577f6f58417cbec3d7195f6 |
| hovercard-subject-tag | discussion:5110503 |
| github-keyboard-shortcuts | repository,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/pythonnet/pythonnet/discussions/2147 |
| twitter:image | https://opengraph.githubassets.com/e7c89b65a392db02536d455eddf2470a9fbb511b1971af437a43593d8728fad1/pythonnet/pythonnet/discussions/2147 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e7c89b65a392db02536d455eddf2470a9fbb511b1971af437a43593d8728fad1/pythonnet/pythonnet/discussions/2147 |
| og:image:alt | I want to use Python in a .NET project, and under Windows, I can use Python with the python3.10.dll. Unfortunately, this project needs to run in a Docker container. First, I tried to set up all com... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9920a62ba22d06470388e2904804fb7e5ec51c9e35f81784e9191394c74b2bd2 |
| turbo-cache-control | no-preview |
| go-import | github.com/pythonnet/pythonnet git https://github.com/pythonnet/pythonnet.git |
| octolytics-dimension-user_id | 6050430 |
| octolytics-dimension-user_login | pythonnet |
| octolytics-dimension-repository_id | 14748123 |
| octolytics-dimension-repository_nwo | pythonnet/pythonnet |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 14748123 |
| octolytics-dimension-repository_network_root_nwo | pythonnet/pythonnet |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 7d6181066430cc06553c8396ca201e194ae33cb9 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width