Skip to content

"Exception: Failed to create virtualenv" during packs.install #53

@arm4b

Description

@arm4b

Reproduce (Ubuntu14)

wget -qO - https://bintray.com/user/downloadSubjectPublicKey?username=bintray | apt-key add -
add-apt-repository 'deb https://dl.bintray.com/stackstorm/trusty_staging unstable main'

# Install Rabbit and Mongo
apt-get update
apt-get install rabbitmq-server mongodb-server

# Install st2
apt-get install st2api st2actions st2auth st2client st2common st2debug st2exporter st2reactor

# Set `enable = False` under `[auth]` section in file: `/etc/st2/st2/conf`
sudo sed -i '/^\[auth\]$/,/^\[/ s/^enable = True/enable = False/' /etc/st2/st2.conf

# Register content
st2-register-content --register-all --config-dir /etc/st2

# Start everything
service st2api start
service st2auth start
service st2actionrunner start
service st2notifier start
service st2resultstracker start
service st2rulesengine start
service st2sensorcontainer start
service st2exporter start

# Install dependencies for packs.install to work
apt-get install git python-virtualenv

# Install some st2 pack
st2 run packs.install packs=github

Error message

# st2 run packs.install packs=github

....
id: 5675a56dfad0d513e9647150
action.ref: packs.install
status: failed
error: st2.actions.python.SetupVirtualEnvironmentAction: DEBUG    Setting up virtualenv for pack "github"
st2.actions.python.SetupVirtualEnvironmentAction: INFO     Virtualenv path "/opt/stackstorm/virtualenvs/github" doesn't exist
st2.actions.python.SetupVirtualEnvironmentAction: DEBUG    Creating virtualenv for pack "github" in "/opt/stackstorm/virtualenvs/github"
st2.actions.python.SetupVirtualEnvironmentAction: DEBUG    Creating virtualenv in "/opt/stackstorm/virtualenvs/github" using Python binary "/usr/share/python/st2actions/bin/python"
Traceback (most recent call last):
  File "/usr/share/python/st2actions/local/lib/python2.7/site-packages/st2actions/runners/python_action_wrapper.py", line 116, in <module>
    obj.run()
  File "/usr/share/python/st2actions/local/lib/python2.7/site-packages/st2actions/runners/python_action_wrapper.py", line 61, in run
    output = action.run(**self._parameters)
  File "/opt/stackstorm/packs/packs/actions/pack_mgmt/setup_virtualenv.py", line 60, in run
    self._setup_pack_virtualenv(pack_name=pack_name, update=update)
  File "/opt/stackstorm/packs/packs/actions/pack_mgmt/setup_virtualenv.py", line 102, in _setup_pack_virtualenv
    self._create_virtualenv(virtualenv_path=virtualenv_path)
  File "/opt/stackstorm/packs/packs/actions/pack_mgmt/setup_virtualenv.py", line 140, in _create_virtualenv
    (virtualenv_path, stderr))
Exception: Failed to create virtualenv in "/opt/stackstorm/virtualenvs/github": Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/virtualenv.py", line 2339, in <module>
    main()
  File "/usr/lib/python2.7/dist-packages/virtualenv.py", line 825, in main
    symlink=options.symlink)
  File "/usr/lib/python2.7/dist-packages/virtualenv.py", line 985, in create_environment
    site_packages=site_packages, clear=clear, symlink=symlink))
  File "/usr/lib/python2.7/dist-packages/virtualenv.py", line 1181, in install_python
    copy_required_modules(home_dir, symlink)
  File "/usr/lib/python2.7/dist-packages/virtualenv.py", line 1120, in copy_required_modules
    copyfile(filename, dst_filename, symlink)
  File "/usr/lib/python2.7/dist-packages/virtualenv.py", line 467, in copyfile
    os.makedirs(os.path.dirname(dest))
  File "/usr/share/python/st2actions/lib/python2.7/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 17] File exists: '/opt/stackstorm/virtualenvs/github/lib/python2.7/lib-dynload'


traceback: None
failed_on: setup_virtualenv
start_timestamp: 2015-12-19T18:43:57.690729Z
end_timestamp: 2015-12-19T18:44:04.361833Z
+--------------------------+-----------+-------------------+-------------------------+-------------------------------+
| id                       | status    | task              | action                  | start_timestamp               |
+--------------------------+-----------+-------------------+-------------------------+-------------------------------+
| 5675a56dfad0d513ff14be8d | succeeded | download          | packs.download          | Sat, 19 Dec 2015 18:43:57 UTC |
| 5675a572fad0d513ff14be90 | succeeded | virtualenv_prerun | packs.virtualenv_prerun | Sat, 19 Dec 2015 18:44:02 UTC |
| 5675a573fad0d513ff14be93 | failed    | setup_virtualenv  | packs.setup_virtualenv  | Sat, 19 Dec 2015 18:44:03 UTC |
+--------------------------+-----------+-------------------+-------------------------+-------------------------------+

Helpful Info:

Broken symlinks:

/opt/stackstorm/virtualenvs/github/lib/python2.7# ls -l
total 0
lrwxrwxrwx 1 root root 38 Dec 19 18:44 codecs.py -> ../../../../../lib/python2.7/codecs.py
lrwxrwxrwx 1 root root 38 Dec 19 18:44 encodings -> ../../../../../lib/python2.7/encodings
lrwxrwxrwx 1 root root 39 Dec 19 18:44 fnmatch.py -> ../../../../../lib/python2.7/fnmatch.py
lrwxrwxrwx 1 root root 43 Dec 19 18:44 genericpath.py -> ../../../../../lib/python2.7/genericpath.py
lrwxrwxrwx 1 root root 40 Dec 19 18:44 lib-dynload -> ../../../../../lib/python2.7/lib-dynload
lrwxrwxrwx 1 root root 38 Dec 19 18:44 locale.py -> ../../../../../lib/python2.7/locale.py
lrwxrwxrwx 1 root root 38 Dec 19 18:44 ntpath.py -> ../../../../../lib/python2.7/ntpath.py
lrwxrwxrwx 1 root root 34 Dec 19 18:44 os.py -> ../../../../../lib/python2.7/os.py
lrwxrwxrwx 1 root root 41 Dec 19 18:44 posixpath.py -> ../../../../../lib/python2.7/posixpath.py
lrwxrwxrwx 1 root root 36 Dec 19 18:44 stat.py -> ../../../../../lib/python2.7/stat.py
lrwxrwxrwx 1 root root 40 Dec 19 18:44 UserDict.py -> ../../../../../lib/python2.7/UserDict.py

https://github.com/StackStorm/st2/blob/master/contrib/packs/actions/pack_mgmt/setup_virtualenv.py might have answers.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions