0

Currently on my linux box I've uninstalled Linux 2.x and replaced it with 3.6 for an application.

Currently I am running supervisor, but cannot get the service to start.

When I attempt to run it I get

Process: 17113 ExecStart=/usr/bin/supervisord -n -c /etc/supervisor/supervisord.conf (code=exited, status=1/FAILURE)

Main PID: 17113 (code=exited, status=1/FAILURE)

So when I look at a more verbose report this is what I get.

File "/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py", line 781, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'supervisor==3.3.1' distribution was not found and is required by the application

When I Looked into this. The error means I need to be running Python 2.x and Supervisor WILL NOT work on any version of Python 3

If this is the case, how do I re-install Python 2.7 and have it run along side 3?

If anyone has seen this error. I've changed my config files to attempt to fix this. Stopped and restarted the service over and over. I've exhausted everything I know how to do and am now reaching out.

I've seen how to do this by installing Python3 along side 2.x but not the other way.

I'm semi-new to linux and don't understand the packages and how to completely navigate.

Mokey
  • 215
  • 1
  • 15
  • Surely you mean you have uninstalled *Python* 2.x, not *Linux* 2.x? Which distro and how exactly did you uninstall it? This is unsupported on many distros, you simply cannot remove the system Python and still have a working installation. – tripleee Oct 26 '18 at 04:38
  • Thanks, @tripleee for your suggestion, lesson learned :) – Pitto Oct 29 '18 at 10:33
  • Possible duplicate of [Use different Python version with virtualenv](https://stackoverflow.com/questions/1534210/use-different-python-version-with-virtualenv) – Pitto Oct 29 '18 at 10:34

1 Answers1

1

I strongly suggest you to use virtual environments in order to be able to install requirements and tweak several different environments on the same pc without causing issue between applications and their specific requirements.

The main tool used by the community is venv.

Here's some commands to install it, create an environment and activate it:

Install

pip install virtualenv

Create a directory to test it

mkdir python-virtual-environments && cd python-virtual-environments

Create a venv

# Python 2
virtualenv env

# Python 3
python3 -m venv env

Activate your new environment

source env/bin/activate

You will see your prompt changing and whatever you install with pip or similar tools will be available ONLY in there.

In your specific case I'd create a Python2 virtualenv to use your application.

Here's how to achieve such a result:

virtualenv --python=/usr/bin/python2.7 <path/to/myvirtualenv>

Here's the relevant documentation.

halfer
  • 19,824
  • 17
  • 99
  • 186
Pitto
  • 8,229
  • 3
  • 42
  • 51
  • This is good advice but this is a common FAQ; you should probably just find an existing question with this information and nominate this one as a duplicate. – tripleee Oct 26 '18 at 04:40