question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Always get `ModuleNotFoundError: No module named 'encodings'` error.

See original GitHub issue

I tried to use twitter-scraper. I ran the command described in the README:

pipenv install twitter-scraper

I got this error back:

❯ pipenv install twitter-scraper
Installing twitter-scraper…
⠇
Error:  An error occurred while installing twitter-scraper!
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: Py_Initialize: unable to load the file system codec
ModuleNotFoundError: No module named 'encodings'

Current thread 0x00007fff793b5000 (most recent call first):

I searched online for ModuleNotFoundError: No module named 'encodings' and could not find anything I could use to solve this.

Describe your environment
  1. OS Type: macOS
  2. Python version: Python 3.7.0b1
  3. Pipenv version: version 10.0.0
Expected result

pipenv works and doesn’t throw that error.

Actual result
~/dev/testing/py-test
❯ pipenv install twitter-scraper --verbose
Installing twitter-scraper…
⠋Installing 'twitter-scraper'
$ "/Users/nikivi/.local/share/virtualenvs/py-test-7jzMe1F-/bin/pip" install   --verbose   "twitter-scraper" -i https://pypi.python.org/simple --exists-action w
⠧
Error:  An error occurred while installing twitter-scraper!
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: Py_Initialize: unable to load the file system codec
ModuleNotFoundError: No module named 'encodings'

Current thread 0x00007fff793b5000 (most recent call first):
Steps to replicate

I ran pipenv install twitter-scraper. But it seems that in my case all instances of pipenv install are broken. Not sure what to do.

Thank you for any help.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

6reactions
nikitavoloboevcommented, Feb 24, 2018

Okay, I realised my mistake. Apparently you cannot run pipenv in a directory that has other files. I ran the command in empty dir and everything worked.

0reactions
nikitavoloboevcommented, Feb 24, 2018

Hi @kennethreitz

I wanted to make sure I do actually have pipenv working as intended. Is this normal that if I have a .py file already in a directory, pipenv fails with that message of ModuleNotFoundError: No module named 'encodings'?

Read more comments on GitHub >

github_iconTop Results From Across the Web

ImportError: No module named 'encodings' - python
It seems like that the python installation is incomplete. Have you installed python via apt or have you compiled and installed it from...
Read more >
ModuleNotFoundError: No module named 'encodings' #516
I keep getting: ModuleNotFoundError: No module named 'encodings' in the unit error logs when trying to add new configuration.
Read more >
No Module named “Encodings” — A common ... - faun.dev
When you download Python3. · Then, open system properties and navigate to the “Advanced” tab. · Ensure that the Python path for your...
Read more >
No Module named “Encodings” — A ... - FAUN Publication
The Solution! · When you download Python3. · Then, open system properties and navigate to the “Advanced” tab. · Ensure that the Python...
Read more >
modulenotfounderror no module named encodings - You.com
Fatal Python error: Py_Initialize: Unable to get the locale encoding ModuleNotFoundError: No module named 'encodings'. The first thing you should try is to ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found