athlete123
athlete123

Reputation: 13

Getting the following error: Could not find a version that satisfies the requirement command-not-found==0.3

I am deploying a Django app using Heroku.

When I run

git push heroku master

in my terminal I get the following error:

Could not find a version that satisfies the requirement command-not-found==0.3"

When I run

sudo apt-get install command-not-found

I find that command-not-found is version 20.04.2. However, pip freeze tells me command-not-found is version 0.3.

Upvotes: 1

Views: 1802

Answers (1)

Chris
Chris

Reputation: 136936

command-not-found doesn't seem to exist on PyPI, but it is a package in Ubuntu and Debian repositories. It doesn't look like anything that your application should depend on, and it certainly doesn't belong on Heroku.

I suspect

  • you're trying to create your dependencies file after the fact, by simply doing pip freeze > requirements.txt, and
  • that you're either not working in a virtual environment or you created your virtual environment with system packages.

This is an antipattern that will cause several packages that your application doesn't actually need to be included in your requirements.txt. In this case it is even including Python packages that come from system packages and aren't meant to be installed from PyPI. Your requirements.txt should contain only your actual dependencies.

Instead of creating it with pip freeze after the fact, add things to that file before, and install them into your virtual environment with the same pip install -r requirements.txt command that you'll use in production. I also very strongly urge you to use a virtual environment.

In this case, I suggest you edit your requirements.txt and remove anything you don't actually need, commit, and redeploy.

Upvotes: 1

Related Questions