Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Cannot create venv as dependencies are unmet

I am running on VirtualBox Ubuntu 18.04.5 LTS. I am running Python 3.6.9.

When trying to create a virtual environment with sudo python3 -m venv env I get:

admin@admin-VirtualBox:~/Desktop/project$ sudo python3 -m venv .venv
The virtual environment was not created successfully because ensurepip is not
available.  On Debian/Ubuntu systems, you need to install the python3-venv
package using the following command.

    apt-get install python3-venv

You may need to use sudo with that command.  After installing the python3-venv
package, recreate your virtual environment.

Failing command: ['/home/admin/Desktop/project/.venv/bin/python3', '-Im', 'ensurepip', '--upgrade', '--default-pip']

admin@admin-VirtualBox:~/Desktop/project$ python3 --version
Python 3.6.9
admin@admin-VirtualBox:~/Desktop/project$ sudo apt-get install python3.6-venv
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 python3.6-venv : Depends: python3.6 (= 3.6.5-3) but 3.6.9-1~18.04ubuntu1.1 is to be installed
E: Unable to correct problems, you have held broken packages.
admin@admin-VirtualBox:~/Desktop/project$ 

I researched and found that python3 has venv already preinstalled. I believe there are some broken dependencies.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

I tried:

admin@admin-VirtualBox:~/Desktop/project$ sudo apt-cache policy python3.6-venv python3.6 python3
python3.6-venv:
  Installed: (none)
  Candidate: 3.6.5-3
  Version table:
     3.6.5-3 500
        500 http://at.archive.ubuntu.com/ubuntu bionic/universe amd64 Packages
python3.6:
  Installed: 3.6.9-1~18.04ubuntu1.1
  Candidate: 3.6.9-1~18.04ubuntu1.1
  Version table:
 *** 3.6.9-1~18.04ubuntu1.1 100
        100 /var/lib/dpkg/status
     3.6.5-3 500
        500 http://at.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
python3:
  Installed: 3.6.7-1~18.04
  Candidate: 3.6.7-1~18.04
  Version table:
 *** 3.6.7-1~18.04 100
        100 /var/lib/dpkg/status
     3.6.5-3 500
        500 http://at.archive.ubuntu.com/ubuntu bionic/main amd64 Packages

Any suggestions how to fix this? What is the problem?

I appreciate your replies!

>Solution :

  1. Run software-properties-gtk

    1st tab: Enable main, universe, 2nd tab: Enable security, updates

  2. Update list when you exit or run

    sudo apt update

  3. Install virtual environment module (I expected it installed on vanilla image)

    sudo apt install python3.6-venv

  4. Create virtual env without using sudo

    python3 -m venv .venv

Btw, it is good to confirm which is the linked version python3 using

ls -l $(which python3)
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading