Commandline Tool giving permission denied due to python path

1.6k views Asked by At

I am using Ubuntu, and installed the bigquery commandline tool through the command documented in the docs using: "easy_install bigquery" (without quotes - see also https://developers.google.com/bigquery/bq-command-line-tool#installation) - as that resulted in an error because of access rights to the python2.7 path, I had to change the command to "sudo easy_install bigquery".

Now everytime I try to run the command "bq" from the commandline, I get the following error: "IOError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/bigquery-2.0.14-py2.7.egg/EGG-INFO/requires.txt'"

It runs fine if I run it with the command "sudo bq" but I would like to run bigquery without having to run it as sudo. I am sure I did something wrong but I can't figure out what. Any suggestions?

Here is the complete trace:

:~$ bq
Traceback (most recent call last):
  File "/usr/local/bin/bq", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2803, in <module>
    working_set.require(__requires__)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 696, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 599, in resolve
    requirements.extend(dist.requires(req.extras)[::-1])
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2235, in requires
    dm = self._dep_map
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2227, in _dep_map
    for extra,reqs in split_sections(self._get_metadata(name)):
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2759, in split_sections
    for line in yield_lines(s):
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1915, in yield_lines
    for ss in strs:
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2249, in _get_metadata
    for line in self.get_metadata_lines(name):
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1219, in get_metadata_lines
    return yield_lines(self.get_metadata(name))
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1211, in get_metadata
    return self._get(self._fn(self.egg_info,name))
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1326, in _get
    stream = open(path, 'rb')
IOError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/bigquery-2.0.14-py2.7.egg/EGG-INFO/requires.txt'

Thanks,

2

There are 2 answers

0
Collin Grady On

Check the permissions on /usr/local/lib/python2.7/dist-packages/bigquery-2.0.14-py2.7.egg and subfolders.

2
user3574138 On

I know that this is probably a year late but I found the solution to this; basically you have to login as a "root" administrator to obtain access to the point where you can potentially edit ANYTHING in the Linux OS. To do this, you have to get on your terminal on your vps account(your normal account), then issue the command

"sudo passwd root".

This will prompt you to make a root account using a password (on other ubuntu versions it can vary). Then to gain access to this "root" account you created, you restart your PC, open the terminal, and issue the command

"su"

to login as a root user; use "sudo" to execute commands.