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: Github.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":"\u003cp dir=\"auto\"\u003eI 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:\u003c/p\u003e\n\u003cp dir=\"auto\"\u003ePython path configuration:\u003cbr\u003e\nPYTHONHOME = '/usr/lib/python3.10/'\u003cbr\u003e\nPYTHONPATH = '/usr/lib/:/usr/lib/python3.10/:/usr/lib/python3.10/encodings/'\u003cbr\u003e\nprogram name = 'python3'\u003cbr\u003e\nisolated = 0\u003cbr\u003e\nenvironment = 1\u003cbr\u003e\nuser site = 1\u003cbr\u003e\nimport site = 1\u003cbr\u003e\nsys._base_executable = '/usr/local/bin/python3'\u003cbr\u003e\nsys.base_prefix = ''\u003cbr\u003e\nsys.base_exec_prefix = ''\u003cbr\u003e\nsys.platlibdir = 'lib'\u003cbr\u003e\nsys.executable = '/usr/local/bin/python3'\u003cbr\u003e\nsys.prefix = ''\u003cbr\u003e\nsys.exec_prefix = ''\u003cbr\u003e\nsys.path = [\u003cbr\u003e\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/',\u003cbr\u003e\n]\u003cbr\u003e\nFatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding\u003cbr\u003e\nPython runtime state: core initialized\u003cbr\u003e\nModuleNotFoundError: No module named 'encodings'\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eCurrent thread 0x00007f1641311740 (most recent call first):\u003cbr\u003e\n\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eMy guess is that I'm not setting some necessary library, but I don't know which one it is.\u003c/p\u003e","upvoteCount":1,"answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"\u003cp dir=\"auto\"\u003eI 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.\u003c/p\u003e","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:96516415-5c67-ff0b-47e8-030bd4c67b94 |
| current-catalog-service-hash | 9f0abe34da433c9b6db74bffa2466494a717b579a96b30a5d252e5090baea7be |
| request-id | 8516:27D737:7CA6FD:AC1B5B:6A63AC5B |
| html-safe-nonce | c78bd9b0e2b8144c5b695c1c18e4b46a31b4cbe57163edd23f752ccc020e52b1 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NTE2OjI3RDczNzo3Q0E2RkQ6QUMxQjVCOjZBNjNBQzVCIiwidmlzaXRvcl9pZCI6IjQ5MzM5MjIzMzI1MDYwNDE0MzUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | cf6c8c712348adc5b0a6b0558020c75e1432289be83298d62bff3e7d18473ca1 |
| 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 | c69b5576237034cb6ab5477391df7811093a00579a751b33bed4b527d68aade6 |
| 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 | 5c31956f7a31ef033ef93ba813dcb6f7e8eb0972 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width