4

I'm working on Elastic Beanstalk on a Django application and I'm a bit naive when it comes to the devops side.

I've having trouble installing pycurl, which I've been advised (with a different SO thread How to run a celery worker with Django app scalable by AWS Elastic Beanstalk?) to add to my requirements.txt file like so:

pycurl==7.43.0 --global-option="--with-nss"

Which leads to:

ERROR: Command errored out with exit status 1:
       command: /opt/python/run/venv/bin/python3.6 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-04ket6ba/pycurl/setup.py'"'"'; __file__='"'"'/tmp/pip-install-04ket6ba/pycurl/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-04ket6ba/pycurl/pip-egg-info
           cwd: /tmp/pip-install-04ket6ba/pycurl/
      Complete output (22 lines):
      Traceback (most recent call last):
        File "/tmp/pip-install-04ket6ba/pycurl/setup.py", line 103, in configure_unix
          stdout=subprocess.PIPE, stderr=subprocess.PIPE)
        File "/usr/lib64/python3.6/subprocess.py", line 729, in __init__
          restore_signals, start_new_session)
        File "/usr/lib64/python3.6/subprocess.py", line 1364, in _execute_child
          raise child_exception_type(errno_num, err_msg, err_filename)
      FileNotFoundError: [Errno 2] No such file or directory: 'curl-config': 'curl-config'

      During handling of the above exception, another exception occurred:

      Traceback (most recent call last):
        File "<string>", line 1, in <module>
        File "/tmp/pip-install-04ket6ba/pycurl/setup.py", line 823, in <module>
          ext = get_extension(sys.argv, split_extension_source=split_extension_source)
        File "/tmp/pip-install-04ket6ba/pycurl/setup.py", line 497, in get_extension
          ext_config = ExtensionConfiguration(argv)
        File "/tmp/pip-install-04ket6ba/pycurl/setup.py", line 71, in __init__
          self.configure()
        File "/tmp/pip-install-04ket6ba/pycurl/setup.py", line 107, in configure_unix
          raise ConfigurationError(msg)
      __main__.ConfigurationError: Could not run curl-config: [Errno 2] No such file or directory: 'curl-config': 'curl-config'

I'm not clear on what's going wrong.

When I ssh into the EBS instance to try and learn how to solve it I can see a warning about the version of pip in use:

You are using pip version 9.0.1, however version 19.3.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

But when I try to upgrade:

source /opt/python/run/venv/bin/activate pip install --upgrade pip

I get a permissions error:

    Exception:
Traceback (most recent call last):
  File "/opt/python/run/venv/lib64/python3.6/shutil.py", line 550, in move
    os.rename(src, real_dst)
PermissionError: [Errno 13] Permission denied: '/opt/python/run/venv/bin/pip' -> '/tmp/pip-5y1ipdun-uninstall/opt/python/run/venv/bin/pip'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/python/run/venv/local/lib/python3.6/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/opt/python/run/venv/local/lib/python3.6/site-packages/pip/commands/install.py", line 342, in run
    prefix=options.prefix_path,
  File "/opt/python/run/venv/local/lib/python3.6/site-packages/pip/req/req_set.py", line 778, in install
    requirement.uninstall(auto_confirm=True)
  File "/opt/python/run/venv/local/lib/python3.6/site-packages/pip/req/req_install.py", line 754, in uninstall
    paths_to_remove.remove(auto_confirm)
  File "/opt/python/run/venv/local/lib/python3.6/site-packages/pip/req/req_uninstall.py", line 115, in remove
    renames(path, new_path)
  File "/opt/python/run/venv/local/lib/python3.6/site-packages/pip/utils/__init__.py", line 267, in renames
    shutil.move(old, new)
  File "/opt/python/run/venv/lib64/python3.6/shutil.py", line 565, in move
    os.unlink(src)
PermissionError: [Errno 13] Permission denied: '/opt/python/run/venv/bin/pip'

I'm a bit stuck and would appreciate any advice on how to get past this.

goose
  • 2,502
  • 6
  • 42
  • 69

3 Answers3

0

Adding these worked for me

packages:
  yum:
    libcurl-devel: []
    openssl-devel: []
HenryM
  • 5,557
  • 7
  • 49
  • 105
0

This is what I had to add to get to work:

packages:
    yum:
        ...
        libcurl-devel: []

Guessed from this answer https://stackoverflow.com/a/27795678/1826211

TKrugg
  • 2,255
  • 16
  • 18
-2

I got around this by adding the following to my EBS config.yml file:

packages:
    yum:
        libcurl-devel: []
        libcurl4-openssl-dev: []
        libssl-dev: []
        python-pycurl: [7.19.3]
goose
  • 2,502
  • 6
  • 42
  • 69