DataDog / dd-agent

Datadog Agent Version 5
https://docs.datadoghq.com/
Other
1.3k stars 812 forks source link

Failed to install on mac osx (venv/bin/python) #2807

Open jeanbza opened 8 years ago

jeanbza commented 8 years ago

Following instructions fails at rake setup_env

Long story short:

Errno::EACCES: Permission denied - venv/bin/python

Long story less-short:

sh: venv/bin/python: is a directory
--2016-09-06 08:20:36--  https://bootstrap.pypa.io/get-pip.py
Resolving bootstrap.pypa.io... 151.101.68.175
Connecting to bootstrap.pypa.io|151.101.68.175|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1524722 (1.5M) [text/x-python]
Saving to: 'venv/get-pip.py'

venv/get-pip.py                              100%[=============================================================================================>]   1.45M  --.-KB/s    in 0.07s

2016-09-06 08:20:36 (22.4 MB/s) - 'venv/get-pip.py' saved [1524722/1524722]

rake aborted!
Errno::EACCES: Permission denied - venv/bin/python
/Users/pivotal/workspace/dd-agent/Rakefile:67:in ``'
/Users/pivotal/workspace/dd-agent/Rakefile:67:in `block in <top (required)>'
Tasks: TOP => setup_env
(See full trace by running task with --trace)

Long story long:

 2016-09-06 08:19:41 ☆  |2.3.0| Pivotals-iMac-3 in ~/workspace/dd-agent
±  |master ✓| → gem install bundler
Fetching: bundler-1.12.5.gem (100%)
Successfully installed bundler-1.12.5
1 gem installed

 2016-09-06 08:19:46 ☆  |2.3.0| Pivotals-iMac-3 in ~/workspace/dd-agent
±  |master ✓| → rbenv rehash

 2016-09-06 08:19:49 ☆  |2.3.0| Pivotals-iMac-3 in ~/workspace/dd-agent
±  |master ✓| → bundle
Fetching gem metadata from https://rubygems.org/
Fetching version metadata from https://rubygems.org/
Resolving dependencies...
Installing rake 11.2.2
Using addressable 2.4.0
Installing ast 2.3.0
Installing colorize 0.8.1
Using multi_xml 0.5.5
Installing powerpack 0.1.1
Installing rainbow 2.1.0
Installing ruby-progressbar 1.8.1
Installing unicode-display_width 1.1.0
Using bundler 1.12.5
Installing parser 2.3.1.2
Using httparty 0.14.0
Installing rubocop 0.38.0
Bundle complete! 5 Gemfile dependencies, 13 gems now installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.

 2016-09-06 08:19:54 ☆  |2.3.0| Pivotals-iMac-3 in ~/workspace/dd-agent
±  |master ✓| → rake setup_env
--2016-09-06 08:20:01--  https://raw.github.com/pypa/virtualenv/1.11.6/virtualenv.py
Resolving raw.github.com... 151.101.68.133
Connecting to raw.github.com|151.101.68.133|:443... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://raw.githubusercontent.com/pypa/virtualenv/1.11.6/virtualenv.py [following]
--2016-09-06 08:20:01--  https://raw.githubusercontent.com/pypa/virtualenv/1.11.6/virtualenv.py
Resolving raw.githubusercontent.com... 151.101.68.133
Connecting to raw.githubusercontent.com|151.101.68.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 98477 (96K) [text/plain]
Saving to: 'venv/virtualenv.py'

venv/virtualenv.py                           100%[=============================================================================================>]  96.17K  --.-KB/s    in 0.006s

2016-09-06 08:20:02 (14.6 MB/s) - 'venv/virtualenv.py' saved [98477/98477]

--2016-09-06 08:20:02--  https://bootstrap.pypa.io/ez_setup.py
Resolving bootstrap.pypa.io... 151.101.68.175
Connecting to bootstrap.pypa.io|151.101.68.175|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 12402 (12K) [text/x-python]
Saving to: 'venv/ez_setup.py'

venv/ez_setup.py                             100%[=============================================================================================>]  12.11K  --.-KB/s    in 0.002s

2016-09-06 08:20:02 (4.78 MB/s) - 'venv/ez_setup.py' saved [12402/12402]

sh: venv/bin/python: No such file or directory
--2016-09-06 08:20:02--  https://bootstrap.pypa.io/get-pip.py
Resolving bootstrap.pypa.io... 151.101.68.175
Connecting to bootstrap.pypa.io|151.101.68.175|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1524722 (1.5M) [text/x-python]
Saving to: 'venv/get-pip.py'

venv/get-pip.py                              100%[=============================================================================================>]   1.45M  --.-KB/s    in 0.07s

2016-09-06 08:20:02 (21.5 MB/s) - 'venv/get-pip.py' saved [1524722/1524722]

rake aborted!
Errno::ENOENT: No such file or directory - venv/bin/python
/Users/pivotal/workspace/dd-agent/Rakefile:67:in ``'
/Users/pivotal/workspace/dd-agent/Rakefile:67:in `block in <top (required)>'
Tasks: TOP => setup_env
(See full trace by running task with --trace)

 2016-09-06 08:20:02 ☆  |2.3.0| Pivotals-iMac-3 in ~/workspace/dd-agent
±  |master ✓| → mkdir -p venv/bin/python

 2016-09-06 08:20:17 ☆  |2.3.0| Pivotals-iMac-3 in ~/workspace/dd-agent
±  |master ✓| → rake setup_env
--2016-09-06 08:20:18--  https://raw.github.com/pypa/virtualenv/1.11.6/virtualenv.py
Resolving raw.github.com... 151.101.68.133
Connecting to raw.github.com|151.101.68.133|:443... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://raw.githubusercontent.com/pypa/virtualenv/1.11.6/virtualenv.py [following]
--2016-09-06 08:20:19--  https://raw.githubusercontent.com/pypa/virtualenv/1.11.6/virtualenv.py
Resolving raw.githubusercontent.com... 151.101.68.133
Connecting to raw.githubusercontent.com|151.101.68.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 98477 (96K) [text/plain]
Saving to: 'venv/virtualenv.py'

venv/virtualenv.py                           100%[=============================================================================================>]  96.17K  --.-KB/s    in 0.008s

2016-09-06 08:20:19 (11.3 MB/s) - 'venv/virtualenv.py' saved [98477/98477]

--2016-09-06 08:20:19--  https://bootstrap.pypa.io/ez_setup.py
Resolving bootstrap.pypa.io... 151.101.68.175
Connecting to bootstrap.pypa.io|151.101.68.175|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 12402 (12K) [text/x-python]
Saving to: 'venv/ez_setup.py'

venv/ez_setup.py                             100%[=============================================================================================>]  12.11K  --.-KB/s    in 0.001s

2016-09-06 08:20:19 (8.39 MB/s) - 'venv/ez_setup.py' saved [12402/12402]

sh: venv/bin/python: is a directory
--2016-09-06 08:20:19--  https://bootstrap.pypa.io/get-pip.py
Resolving bootstrap.pypa.io... 151.101.68.175
Connecting to bootstrap.pypa.io|151.101.68.175|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1524722 (1.5M) [text/x-python]
Saving to: 'venv/get-pip.py'

venv/get-pip.py                              100%[=============================================================================================>]   1.45M  --.-KB/s    in 0.07s

2016-09-06 08:20:19 (21.9 MB/s) - 'venv/get-pip.py' saved [1524722/1524722]

rake aborted!
Errno::EACCES: Permission denied - venv/bin/python
/Users/pivotal/workspace/dd-agent/Rakefile:67:in ``'
/Users/pivotal/workspace/dd-agent/Rakefile:67:in `block in <top (required)>'
Tasks: TOP => setup_env
(See full trace by running task with --trace)

 2016-09-06 08:20:19 ☆  |2.3.0| Pivotals-iMac-3 in ~/workspace/dd-agent
±  |master ✓| → rm -rf venv/
bin/            ez_setup.py     get-pip.py      virtualenv.py   virtualenv.pyc

 2016-09-06 08:20:19 ☆  |2.3.0| Pivotals-iMac-3 in ~/workspace/dd-agent
±  |master ✓| → rm -rf venv/
bin/            ez_setup.py     get-pip.py      virtualenv.py   virtualenv.pyc

 2016-09-06 08:20:19 ☆  |2.3.0| Pivotals-iMac-3 in ~/workspace/dd-agent
±  |master ✓| → rm -rf venv/bin/python/

 2016-09-06 08:20:30 ☆  |2.3.0| Pivotals-iMac-3 in ~/workspace/dd-agent
±  |master ✓| → chmod -R 777 venv/

 2016-09-06 08:20:33 ☆  |2.3.0| Pivotals-iMac-3 in ~/workspace/dd-agent
±  |master ✓| → rake setup_env
--2016-09-06 08:20:35--  https://raw.github.com/pypa/virtualenv/1.11.6/virtualenv.py
Resolving raw.github.com... 151.101.68.133
Connecting to raw.github.com|151.101.68.133|:443... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://raw.githubusercontent.com/pypa/virtualenv/1.11.6/virtualenv.py [following]
--2016-09-06 08:20:35--  https://raw.githubusercontent.com/pypa/virtualenv/1.11.6/virtualenv.py
Resolving raw.githubusercontent.com... 151.101.68.133
Connecting to raw.githubusercontent.com|151.101.68.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 98477 (96K) [text/plain]
Saving to: 'venv/virtualenv.py'

venv/virtualenv.py                           100%[=============================================================================================>]  96.17K  --.-KB/s    in 0.006s

2016-09-06 08:20:35 (15.5 MB/s) - 'venv/virtualenv.py' saved [98477/98477]

--2016-09-06 08:20:35--  https://bootstrap.pypa.io/ez_setup.py
Resolving bootstrap.pypa.io... 151.101.68.175
Connecting to bootstrap.pypa.io|151.101.68.175|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 12402 (12K) [text/x-python]
Saving to: 'venv/ez_setup.py'

venv/ez_setup.py                             100%[=============================================================================================>]  12.11K  --.-KB/s    in 0.002s

2016-09-06 08:20:36 (6.19 MB/s) - 'venv/ez_setup.py' saved [12402/12402]

sh: venv/bin/python: is a directory
--2016-09-06 08:20:36--  https://bootstrap.pypa.io/get-pip.py
Resolving bootstrap.pypa.io... 151.101.68.175
Connecting to bootstrap.pypa.io|151.101.68.175|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1524722 (1.5M) [text/x-python]
Saving to: 'venv/get-pip.py'

venv/get-pip.py                              100%[=============================================================================================>]   1.45M  --.-KB/s    in 0.07s

2016-09-06 08:20:36 (22.4 MB/s) - 'venv/get-pip.py' saved [1524722/1524722]

rake aborted!
Errno::EACCES: Permission denied - venv/bin/python
/Users/pivotal/workspace/dd-agent/Rakefile:67:in ``'
/Users/pivotal/workspace/dd-agent/Rakefile:67:in `block in <top (required)>'
Tasks: TOP => setup_env
(See full trace by running task with --trace)
jeanbza commented 8 years ago

This seems to be a problem at /Library/Python/2.7/site-packages/pip:

 2016-09-06 08:26:10 ☆  |2.3.0| Pivotals-iMac-3 in ~/workspace/dd-agent
±  |master ?:1 ✗| → python venv/get-pip.py
Collecting pip
  Downloading pip-8.1.2-py2.py3-none-any.whl (1.2MB)
    100% |████████████████████████████████| 1.2MB 1.5MB/s
Collecting wheel
  Downloading wheel-0.29.0-py2.py3-none-any.whl (66kB)
    100% |████████████████████████████████| 71kB 13.1MB/s
Installing collected packages: pip, wheel
Exception:
Traceback (most recent call last):
  File "/var/folders/r2/0psx9x1j429c5gdl6w8nn1t00000gn/T/tmpRxGU08/pip.zip/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/var/folders/r2/0psx9x1j429c5gdl6w8nn1t00000gn/T/tmpRxGU08/pip.zip/pip/commands/install.py", line 317, in run
    prefix=options.prefix_path,
  File "/var/folders/r2/0psx9x1j429c5gdl6w8nn1t00000gn/T/tmpRxGU08/pip.zip/pip/req/req_set.py", line 742, in install
    **kwargs
  File "/var/folders/r2/0psx9x1j429c5gdl6w8nn1t00000gn/T/tmpRxGU08/pip.zip/pip/req/req_install.py", line 831, in install
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
  File "/var/folders/r2/0psx9x1j429c5gdl6w8nn1t00000gn/T/tmpRxGU08/pip.zip/pip/req/req_install.py", line 1032, in move_wheel_files
    isolated=self.isolated,
  File "/var/folders/r2/0psx9x1j429c5gdl6w8nn1t00000gn/T/tmpRxGU08/pip.zip/pip/wheel.py", line 346, in move_wheel_files
    clobber(source, lib_dir, True)
  File "/var/folders/r2/0psx9x1j429c5gdl6w8nn1t00000gn/T/tmpRxGU08/pip.zip/pip/wheel.py", line 317, in clobber
    ensure_dir(destdir)
  File "/var/folders/r2/0psx9x1j429c5gdl6w8nn1t00000gn/T/tmpRxGU08/pip.zip/pip/utils/__init__.py", line 83, in ensure_dir
    os.makedirs(path)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/pip'

Perhaps the solution is simply better output logging for the rake task?

jeanbza commented 8 years ago

Actually, on second thought, nevermind - fixing that issue didn't fix the rake problem.

jeanbza commented 8 years ago

Creating symlinks fixed the problem, which is fairly not-ideal:

 2016-09-06 08:33:28 ☆  |2.3.0| Pivotals-iMac-3 in ~/workspace/dd-agent
±  |master ?:1 ✗| → ln -s /usr/local/Cellar/python/2.7.12/bin/pip venv/bin/python
pip*    pip2*   pip2.7*

 2016-09-06 08:33:28 ☆  |2.3.0| Pivotals-iMac-3 in ~/workspace/dd-agent
±  |master ?:1 ✗| → ln -s /usr/local/Cellar/python/2.7.12/bin/pip venv/bin/pip

(some permission problems popped up after that)

gmassanek commented 7 years ago

I ran into this same issue and symlinks brought me to #2808. Is this fix possibly causing the issues in #2808? Did you find a workaround?