9

I am getting following error while creating executing pipenv shell command:

â ‹/usr/bin/python3: No module named pipenv.pew

Virtualenv location: 
Creating a Pipfile for this project…
Traceback (most recent call last):
  File "/usr/bin/pipenv", line 11, in <module>
    load_entry_point('pipenv==11.9.0', 'console_scripts', 'pipenv')()
  File "/usr/lib/python3/dist-packages/pipenv/vendor/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/pipenv/vendor/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/pipenv/vendor/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3/dist-packages/pipenv/vendor/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/pipenv/vendor/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/pipenv/cli.py", line 571, in shell
    core.do_shell(
  File "/usr/lib/python3/dist-packages/pipenv/core.py", line 2093, in do_shell
    ensure_project(three=three, python=python, validate=False)
  File "/usr/lib/python3/dist-packages/pipenv/core.py", line 636, in ensure_project
    ensure_pipfile(validate=validate, skip_requirements=skip_requirements)
  File "/usr/lib/python3/dist-packages/pipenv/core.py", line 289, in ensure_pipfile
    project.create_pipfile(python=python)
  File "/usr/lib/python3/dist-packages/pipenv/project.py", line 518, in create_pipfile
    'python_version': python_version(required_python)[: len('2.7')]

TypeError: 'NoneType' object is not subscriptable

For hosting on heroku I require pipenv shell.

5 Answers5

10

I was facing the same problem on Ubuntu 20.04, but since you are on heroku I am not sure if you can execute these but, in your terminal:

sudo apt-get remove python3-pipenv
sudo pip3 install pipenv (or sudo pip install pipenv)

After that I had another problem with the version of virtualenv. For that I removed python3-virtualenv and the version of virtualenv installed by pip

sudo apt-get remove python3-virtualenv
sudo pip3 install virtualenv

You can check, if pipenv works: /home/[your_username]/.local/bin/pipenv

If you still face a problem with virtualenv, look here: https://github.com/pypa/pipenv/issues

After it works, add /home/[your_user]/.local/bin/ to your PATH:

export PATH=$PATH:~/.local/bin/
David
  • 254
0

Some it's the case when you need to add path to your binaries. like adding /home/<username>/.local/bin to you $PATH.

use this to add it.

PYTHON_BIN_PATH="$(python3 -m site --user-base)/bin"
PATH="$PATH:$PYTHON_BIN_PATH"
0

Sometimes it can be due to permission issues. I run sudo pipenv shell it worked.

0

In my case there was no Python 2 installed and no python executeable in my PATH. To fix this, I created a simbolic link:

# find location of python3
$ which python3
/usr/bin/python3

create link from python to python3 in the original directory

$ ln -s /usr/bin/python3 /usr/bin/python

-1

I think is better that you use python3-venv instead of pipenv

you can install with below code

sudo apt install python3-venv

and create a virtualenv with:

python3 -m venv <folder name for virtualenv>

and active it with:

source <folder name for virtualenv>/bin/activate

and deactivate with:

deactivate

you can use python3.8 instead of python3(Especially when another version of Python is installed on your system)

I hope it helps you

Hmdbbgh
  • 284