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.

import JSON error

See original GitHub issue

Issue description

Getting the error:

C:\Users\rohan\Desktop\pipenv test>pipenv install requests
Warning: Your Pipfile requires python_version 3.6, but you are using 3.7.3 (C:\Users\rohan\.\r\S\python.exe).
  $ pipenv --rm and rebuilding the virtual environment may resolve the issue.
  $ pipenv check will surely fail.
Installing requests…
Adding requests to Pipfile's [packages]…
Installation Succeeded
Pipfile.lock not found, creating…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
Locking Failed!
Traceback (most recent call last):
  File "c:/users/rohan/appdata/local/programs/python/python37/lib/site-packages/pipenv/resolver.py", line 3, in <module>
    import json
ModuleNotFoundError: No module named 'json'
File "c:/users/rohan/appdata/local/programs/python/python37/lib/site-packages/pipenv/resolver.py", line 3, in <module>
    import json
ModuleNotFoundError: No module named 'json'

Been trying to fix it for hours with staff on the Python Discord server with 15,000 members. After 2 hours they sent me here.

Expected result

To install requests…

Actual result

C:\Users\rohan\Desktop\pipenv test>pipenv install --verbose requests
Warning: Your Pipfile requires python_version 3.6, but you are using 3.7.3 (C:\Users\rohan\.\r\S\python.exe).
  $ pipenv --rm and rebuilding the virtual environment may resolve the issue.
  $ pipenv check will surely fail.
Installing requests…
[    ] Installing...Installing 'requests'
$ ['C:\\Users\\rohan\\.virtualenvs\\rohan-D2oimpxC\\Scripts\\pip.exe', 'install', '--verbose', '--upgrade', 'requests', '-i', 'https://pypi.org/simple']
Adding requests to Pipfile's [packages]…
Installation Succeeded
Pipfile.lock not found, creating…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
Locking Failed!
Traceback (most recent call last):
  File "c:/users/rohan/appdata/local/programs/python/python37/lib/site-packages/pipenv/resolver.py", line 3, in <module>
    import json
ModuleNotFoundError: No module named 'json'
File "c:/users/rohan/appdata/local/programs/python/python37/lib/site-packages/pipenv/resolver.py", line 3, in <module>
    import json
ModuleNotFoundError: No module named 'json'

Steps to replicate

No Pipfile created


Please run $ pipenv --support, and paste the results here. Don’t put backticks (`) around it! The output already contains Markdown formatting.

C:\Users\rohan\Desktop\pipenv test>pipenv --support

$ pipenv --support

Pipenv version: '2018.11.26'

Pipenv location: 'c:\\users\\rohan\\appdata\\local\\programs\\python\\python37\\lib\\site-packages\\pipenv'

Python location: 'c:\\users\\rohan\\appdata\\local\\programs\\python\\python37\\python.exe'

Python installations found:

  • 3.7.3: C:\Users\rohan\AppData\Local\Programs\Python\Python37\python.exe

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '3.7.3',
 'os_name': 'nt',
 'platform_machine': 'AMD64',
 'platform_python_implementation': 'CPython',
 'platform_release': '10',
 'platform_system': 'Windows',
 'platform_version': '10.0.17134',
 'python_full_version': '3.7.3',
 'python_version': '3.7',
 'sys_platform': 'win32'}

System environment variables:

  • ALLUSERSPROFILE
  • APPDATA
  • COMMONPROGRAMFILES
  • COMMONPROGRAMFILES(X86)
  • COMMONPROGRAMW6432
  • COMPUTERNAME
  • COMSPEC
  • DRIVERDATA
  • ETHEREUM_SOCKET
  • FPS_BROWSER_APP_PROFILE_STRING
  • FPS_BROWSER_USER_PROFILE_STRING
  • HOMEDRIVE
  • HOMEPATH
  • LOCALAPPDATA
  • LOGONSERVER
  • NUMBER_OF_PROCESSORS
  • ONEDRIVE
  • ONEDRIVECONSUMER
  • OS
  • PATH
  • PATHEXT
  • PROCESSOR_ARCHITECTURE
  • PROCESSOR_IDENTIFIER
  • PROCESSOR_LEVEL
  • PROCESSOR_REVISION
  • PROGRAMDATA
  • PROGRAMFILES
  • PROGRAMFILES(X86)
  • PROGRAMW6432
  • PROMPT
  • PSMODULEPATH
  • PUBLIC
  • PYCHARM COMMUNITY EDITION
  • SESSIONNAME
  • SYSTEMDRIVE
  • SYSTEMROOT
  • TEMP
  • TMP
  • USERDOMAIN
  • USERDOMAIN_ROAMINGPROFILE
  • USERNAME
  • USERPROFILE
  • WINDIR
  • PIP_DISABLE_PIP_VERSION_CHECK
  • PYTHONDONTWRITEBYTECODE
  • PIP_SHIMS_BASE_MODULE
  • PIP_PYTHON_PATH
  • PYTHONFINDER_IGNORE_UNSUPPORTED

Pipenv–specific environment variables:

Debug–specific environment variables:

  • PATH: C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files (x86)\Razer Chroma SDK\bin;C:\Program Files\Razer Chroma SDK\bin;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Users\rohan\AppData\Local\Microsoft\WindowsApps;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Users\rohan\Desktop;C:\Program Files (x86)\OpenVPN\bin;C:\Users\rohan\AppData\Local\Programs\Python36;C:\Program Files\Git\cmd;C:\WINDOWS\System32\OpenSSH\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\PuTTY\;C:\ffmpeg-4.1-win64-static\bin;C:\Users\rohan\AppData\Local\Programs\Python\Python37\Scripts\;C:\Users\rohan\AppData\Local\Programs\Python\Python37\;C:\Users\rohan\AppData\Local\Microsoft\WindowsApps;C:\Users\rohan\AppData\Local\atom\bin;C:\Program Files\heroku\bin;C:\Program Files\JetBrains\PyCharm Community Edition 2019.1\bin;

Contents of Pipfile (‘C:\Users\rohan\Pipfile’):

[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]

[packages]
requests = "*"
json = "*"
request = "*"
numpy = "*"

[requires]
python_version = "3.6"

C:\Users\rohan\Desktop\pipenv test>

If you’re on macOS, run the following:

$ pipenv --support | pbcopy

If you’re on Windows, run the following:

> pipenv --support | clip

If you’re on Linux, run the following:

$ pipenv --support | xclip

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
frostmingcommented, Apr 5, 2019

@RohanRadia May I ask you do the following and see the results

  1. C:\Users\rohan\AppData\Local\Programs\Python\Python37\python.exe -c "import json"
  2. pipenv --rm & pipenv install requests
1reaction
RohanRadiacommented, Apr 5, 2019

C:\Users\rohan>C:\Users\rohan\AppData\Local\Programs\Python\Python37\python.exe -c “import json”

C:\Users\rohan>

C:\Users\rohan\Desktop\pipenv test>pipenv --rm & pipenv install requests Removing virtualenv (C:\Users\rohan.virtualenvs\rohan-D2oimpxC)… Creating a virtualenv for this project… Pipfile: C:\Users\rohan\Pipfile Using C:/Users/rohan/AppData/Local/Programs/Python/Python37/python.exe (3.7.3) to create virtualenv… [ ==] Creating virtual environment…Using base prefix ‘C:\Users\rohan\AppData\Local\Programs\Python\Python37’ New python executable in C:\Users\rohan.virtualenvs\rohan-D2oimpxC\Scripts\python.exe Installing setuptools, pip, wheel… done. Running virtualenv with interpreter C:/Users/rohan/AppData/Local/Programs/Python/Python37/python.exe

Successfully created virtual environment! Virtualenv location: C:\Users\rohan.virtualenvs\rohan-D2oimpxC Installing requests… Adding requests to Pipfile’s [packages]… Installation Succeeded Pipfile.lock not found, creating… Locking [dev-packages] dependencies… Locking [packages] dependencies… Success! Updated Pipfile.lock (24c40d)! Installing dependencies from Pipfile.lock (24c40d)… ================================ 6/6 - 00:00:09 To activate this project’s virtualenv, run pipenv shell. Alternatively, run a command inside the virtualenv with pipenv run.

C:\Users\rohan\Desktop\pipenv test>


Mhm, did it work all of sudden?

Read more comments on GitHub >

github_iconTop Results From Across the Web

python json module import error - Stack Overflow
You are using Python 2.4.3 and json seems to be new in python 2.6, please update python.
Read more >
error on import json file - Tableau Community
As the error message says, that's not really valid JSON. It's multiple JSON objects, separated by commas. The easiest fix in a text...
Read more >
json — JSON encoder and decoder — Python 3.11.1 ...
json exposes an API familiar to users of the standard library marshal and pickle modules. Encoding basic Python object hierarchies: >>> >>> import...
Read more >
Error "from itsdangerous import json as _json ImportError
This issue seems to be related: ImportError: cannot import name 'soft_unicode' ... The problem disappeared after an update to version 1.1.4.
Read more >
How to Import JSON file as a Module - Bits and Pieces
Next, consider importing the JSON file with the following statement: import dinosaurs from './dinosaurs.json';. Google Chrome shows the following error: Failed ...
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