weixin_39966602
2020-12-26 06:09 阅读 0

Issue with creating VENV

  • I'm submitting a ...
  • [ ] bug report
  • [ ] feature request
  • [X ] support request

  • What is the current behavior? Hi Pierre, In the installation process via command line (only way to install on Linux afaik), the following step is not working for me.


xkra:~/node-launcher$ python3.7 -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/xkra/node-launcher/venv/bin/python3.7', '-Im', 'ensurepip', '--upgrade', '--default-pip']

I have installed python3-venv, see as follows:


xkra:~/node-launcher$ sudo apt-get install python3-venv
Reading package lists... Done
Building dependency tree       
Reading state information... Done
python3-venv is already the newest version (3.6.7-1~18.04).
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.

I also did the following: sudo apt-get install python-pip I am a command line n00b and have not much experience in how to fix this - would greatly appreciate if you could help me out.

  • If the current behavior is a bug, please provide the steps to reproduce N/A

  • What is the expected behavior? Not sure :)

  • What is the motivation / use case for changing the behavior? Get your Node Launcher running!

  • Please tell us about your environment:

  • Operating System: [ Ubuntu 18.04.2 LTS]

该提问来源于开源项目:lightning-power-users/node-launcher

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

5条回答 默认 最新

  • weixin_39676979 weixin_39676979 2020-12-26 06:09

    Hi , unfortunately Ubuntu 18.04 has Python 3.6, not Python 3.7. Try following this guide to getting 3.7: http://ubuntuhandbook.org/index.php/2019/02/install-python-3-7-ubuntu-18-04/

    点赞 评论 复制链接分享
  • weixin_39966602 weixin_39966602 2020-12-26 06:09

    Thanks Pierre, I followed this walkthrough to install Python 3.7.2. Nevertheless, ensurepip seems to be 'blocked' by Ubuntu. I tried to create the venv without pip (a suggestion I found somewhere), but am not sure whether the following issue is connected to that. Any ideas?

    
    xkra:~$ python3 -m venv venv --without-pip
    xkra:~$ . venv/bin/activate
    (venv) xkra:~$ pip3.7 install -r requirements.txt
    Traceback (most recent call last):
      File "/usr/lib/command-not-found", line 28, in <module>
        from CommandNotFound import CommandNotFound
      File "/usr/lib/python3/dist-packages/CommandNotFound/CommandNotFound.py", line 19, in <module>
        from CommandNotFound.db.db import SqliteDatabase
      File "/usr/lib/python3/dist-packages/CommandNotFound/db/db.py", line 5, in <module>
        import apt_pkg
    ModuleNotFoundError: No module named 'apt_pkg'
    Error in sys.excepthook:
    Traceback (most recent call last):
      File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
        from apport.fileutils import likely_packaged, get_recent_crashes
      File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
        from apport.report import Report
      File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module>
        import apport.fileutils
      File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>
        from apport.packaging_impl import impl as packaging
      File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 24, in <module>
        import apt
      File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module>
        import apt_pkg
    ModuleNotFoundError: No module named 'apt_pkg'
    
    Original exception was:
    Traceback (most recent call last):
      File "/usr/lib/command-not-found", line 28, in <module>
        from CommandNotFound import CommandNotFound
      File "/usr/lib/python3/dist-packages/CommandNotFound/CommandNotFound.py", line 19, in <module>
        from CommandNotFound.db.db import SqliteDatabase
      File "/usr/lib/python3/dist-packages/CommandNotFound/db/db.py", line 5, in <module>
        import apt_pkg
    ModuleNotFoundError: No module named 'apt_pkg'
    </module></module></module></module></module></module></module></module></module></module></module>
    点赞 评论 复制链接分享
  • weixin_39676979 weixin_39676979 2020-12-26 06:09

    I'll get a ubuntu box up and try reproducing

    点赞 评论 复制链接分享
  • weixin_39685762 weixin_39685762 2020-12-26 06:09

    Hi , I just tried it on a Ubuntu 18.04, first installed python3.7.1 with sudo apt install python3.7, nothing special, but then I got tricked too by the error message that asked me to install python3-venv, because it is in fact already installed. I installed python3.7-venv instead, and after that python3.7 -m venv venv works as intended. To sum it up, sudo apt install python3.7-venv should solve your issue. [EDIT] it seems that creating a venv with the --without pip flag doesn't allow you to install new packages, that's why you got those error messages.

    点赞 评论 复制链接分享
  • weixin_39676979 weixin_39676979 2020-12-26 06:09

    Thank you ! I've added that line to the readme

    点赞 评论 复制链接分享

相关推荐