Mac OS X - ./letsencrypt-auto: line 112: virtualenv: command not found


#1

Greetings from a newbie.

I tried installing the client on OS X (El Capitan, 10.11.2) but encounter the following error:

Creating virtual environment…
./letsencrypt-auto: line 112: virtualenv: command not found

Line 112 of letsencrypt-auto says:
virtualenv --no-site-packages --python $LE_PYTHON $VENV_PATH > /dev/null

Running which virtualenv returns nothing.

However, there are virtualenv files in the following directories:
/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/py2app/bootstrap/
/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/py2app/recipes/
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/py2app/bootstrap/
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/py2app/recipes/
/usr/local/lib/python2.7/site-packages/ - what seems to be virtualenv-13.1.2

So, I’m not sure how to proceed.

I did try to install a ubuntu 15.04 virtual machine on the server but I kept getting errors in authenticating to the Mac server.

I would like to assist with getting the client running reliably on Mac OS X, so that’s the route I’d prefer to follow.

Many thanks - gary2002


#2

This is a transcript of what I’m seeing:

/letsencrypt-auto --debug
grep: /etc/os-release: No such file or directory
Bootstrapping dependencies for Mac OS X…
Warning: augeas-1.4.0 already installed
Warning: dialog-1.2-20150528 already installed
virtualenv Not Installed
Installing with pip
Requirement already satisfied (use --upgrade to upgrade): virtualenv in /usr/local/lib/python2.7/site-packages
Creating virtual environment…
./letsencrypt-auto: line 163: virtualenv: command not found

The confusion seems to be with determining whether virtualenv is installed or not. . . .


#3

Similar error: OSX 10.10.5

$ ./letsencrypt-auto --help
grep: /etc/os-release: No such file or directory
WARNING: Mac OS X support is very experimental at present…
if you would like to work on improving it, please ensure you have backups
and then run this script again with the --debug flag!


#4

You might try sudo pip install -U virtualenv to ensure it’s the latest version.

I use fink to install most things including virtualenv and it ends up in /sw/bin which is equivalent to /usr/local/bin


#5

virtualenv is already up to date:

$ sudo pip install -U virtualenv
Password:
The directory ‘/Users/admin/Library/Caches/pip/http’ or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag.
The directory ‘/Users/admin/Library/Caches/pip’ or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag.
Requirement already up-to-date: virtualenv in /usr/local/lib/python2.7/site-packages
$ pip install -U virtualenv
Requirement already up-to-date: virtualenv in /usr/local/lib/python2.7/site-packages

I’m wondering if there is an issue with an environment variable. I have virtualenv.py and virtualenv.pyc in the site-packages directory referred to above.


#6

Can you post the output of echo $PATH?


#7

Hi! Thanks for your help.

$PATH:
PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/Server.app/Contents/ServerRoot/usr/bin:/Applications/Server.app/Contents/ServerRoot/usr/sbin:/usr/local/mysql/bin

I’m running as user “admin” on a Mac Mini, OS X 11.11.1 - El Capitan

Complete transcript:
xxx:$ env
TERM_PROGRAM=Apple_Terminal
SHELL=/bin/bash
TERM=xterm-256color
TMPDIR=/var/folders/kq/81xk5v391yd1_cqpq6w6f6rr0000gn/T/
Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.LVCb8BpuSn/Render
TERM_PROGRAM_VERSION=361
TERM_SESSION_ID=9C86510C-8319-476D-AC25-A7AEA69570E8
USER=admin
SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.bfM1XATBBA/Listeners
__CF_USER_TEXT_ENCODING=0x1F5:0x0:0x0
PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/Server.app/Contents/ServerRoot/usr/bin:/Applications/Server.app/Contents/ServerRoot/usr/sbin:/usr/local/mysql/bin
PWD=/Users/admin
LANG=en_AU.UTF-8
XPC_FLAGS=0x0
XPC_SERVICE_NAME=0
SHLVL=1
HOME=/Users/admin
LOGNAME=admin
_=/usr/bin/env
xxx:$ cd letsencrypt
xxx:$ ./letsencrypt-auto --debug
grep: /etc/os-release: No such file or directory
Bootstrapping dependencies for Mac OS X…
Warning: augeas-1.4.0 already installed
Warning: dialog-1.2-20150528 already installed
virtualenv Not Installed
Installing with pip
Requirement already satisfied (use --upgrade to upgrade): virtualenv in /usr/local/lib/python2.7/site-packages
Creating virtual environment…
./letsencrypt-auto: line 163: virtualenv: command not found
xxx:$


#8

It looks like virtualenv is installed, but your path does not include the directory where it was installed. I am not super familiar with OS X, Brew, or MacPorts, but there should be an executable file named exactly virtualenv somewhere (not virtualenv.py). You should modify your PATH to include the directory where that executable file lives.

You can also try a pip user install:

pip install --user virtualenv

This will put virtualenv in a directory inside your home directory. You will still have to modify your PATH to point at it.


#9

This gets strange.

I did a cd / - to place me in the root of the file tree.
Then: sudo find . -print | grep virtualenv

Lots of virtualenv files with .py extensions, etc, but no “virtualenv” singular. Anywhere.

Next: pip install --user virtualenv
Requirement already satisfied (use --upgrade to upgrade): virtualenv in /usr/local/lib/python2.7/site-packages

So, pip thinks that virtualenv is in the site-packages directory, which contains the following:
total 408
drwxr-xr-x 6 admin admin 204 11 Nov 08:43 _markerlib
-rw-r–r-- 1 admin admin 126 11 Nov 08:43 easy_install.py
-rw-r–r-- 1 admin admin 367 11 Nov 08:43 easy_install.pyc
drwxr-xr-x 34 admin admin 1156 11 Nov 08:40 pip
drwxr-xr-x 10 admin admin 340 11 Nov 08:40 pip-7.1.2-py2.7.egg-info
drwxr-xr-x 5 admin admin 170 11 Nov 08:43 pkg_resources
drwxr-xr-x 51 admin admin 1734 11 Nov 08:43 setuptools
drwxr-xr-x 11 admin admin 374 11 Nov 08:43 setuptools-18.5.dist-info
-rw-r–r-- 1 admin admin 2657 11 Nov 08:40 sitecustomize.py
-rw-r–r-- 1 admin admin 1491 11 Nov 08:40 sitecustomize.pyc
drwxr-xr-x 10 admin admin 340 10 Nov 23:20 virtualenv-13.1.2.dist-info
-rw-r–r-- 1 admin admin 99421 10 Nov 23:19 virtualenv.py
-rw-r–r-- 1 admin admin 86510 10 Nov 23:19 virtualenv.pyc
drwxr-xr-x 8 admin admin 272 10 Nov 23:20 virtualenv_support
drwxr-xr-x 32 admin admin 1088 11 Nov 08:40 wheel
drwxr-xr-x 9 admin admin 306 11 Nov 08:40 wheel-0.26.0-py2.7.egg-info

so . . . . ? :wink:


#10

The following commands should work:

ln -s /usr/local/lib/python2.7/site-packages/virtualenv.py /usr/local/bin/virtualenv
chmod a+x /usr/local/bin/virtualenv

The first command creates a symlink in /usr/local/bin which allows you to run virtualenv.py as virtualenv and the second command marks /usr/local/bin/virtualenv as executable.


#11

Bingo!!

Now I get "no installers available for your OS - run with “certonly” to install manually.

It’s one small step for a man . . . . . well, you know the rest :wink:

MANY THANKS!!!