jaraco / irc

Full-featured Python IRC library for Python.
MIT License
392 stars 87 forks source link

Unable to install via PIP (unsafe to install) #33

Closed jaraco closed 8 years ago

jaraco commented 8 years ago

Attempting to install IRC to my windows using python 3.3 & PIP.

Fails to install with the following message:

"The package setup script has attempted to modify files on your system

that are not within the EasyInstall build area, and has been aborted.

This package cannot be safely installed by EasyInstall, and may not

support alternate installation locations even if you run its setup

script by hand. Please inform the package's author and the EasyInstall

maintainers to find out if a fix or workaround is available."

PIP is working on my system (tested it by installing "httpie" which went ok :( )

Any help would be greatly appreciated!!

Full log file:

Downloading/unpacking irc

Getting page https://pypi.python.org/simple/irc/ URLs to search for versions for irc:

setuptools.sandbox.SandboxViolation: SandboxViolation: open('C:\Python33\lib\lib2to3\Grammar3.3.2.final.0.pickle', 'wb') {}

The package setup script has attempted to modify files on your system

that are not within the EasyInstall build area, and has been aborted.

This package cannot be safely installed by EasyInstall, and may not

support alternate installation locations even if you run its setup

script by hand. Please inform the package's author and the EasyInstall

maintainers to find out if a fix or workaround is available.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "C:\Python33\lib\site-packages\setuptools\command\easy_install.py", line 1016, in run_setup

run_setup(setup_script, args)

File "C:\Python33\lib\site-packages\setuptools\sandbox.py", line 69, in run_setup

lambda: execfile(

File "C:\Python33\lib\site-packages\setuptools\sandbox.py", line 120, in run

return func()

File "C:\Python33\lib\site-packages\setuptools\sandbox.py", line 71, in

{'__file__':setup_script, '__name__':'__main__'}

File "C:\Python33\lib\site-packages\setuptools\compat.py", line 94, in execfile

exec_(compile(source, fn, 'exec'), globs, locs)

File "setup.py", line 55, in

File "C:\Python33\lib\distutils\core.py", line 165, in setup

raise SystemExit("error: " + str(msg))

SystemExit: error: SandboxViolation: open('C:\Python33\lib\lib2to3\Grammar3.3.2.final.0.pickle', 'wb') {}

The package setup script has attempted to modify files on your system

that are not within the EasyInstall build area, and has been aborted.

This package cannot be safely installed by EasyInstall, and may not

support alternate installation locations even if you run its setup

script by hand. Please inform the package's author and the EasyInstall

maintainers to find out if a fix or workaround is available.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "", line 16, in

File "c:\users\tom\appdata\local\temp\pip_build_Tom\irc\setup.py", line 48, in

setuptools.setup(**setup_params)

File "C:\Python33\lib\distutils\core.py", line 109, in setup

_setup_distribution = dist = klass(attrs)

File "C:\Python33\lib\site-packages\setuptools\dist.py", line 239, in init

self.fetch_build_eggs(attrs.pop('setup_requires'))

File "C:\Python33\lib\site-packages\setuptools\dist.py", line 263, in fetch_build_eggs

parse_requirements(requires), installer=self.fetch_build_egg

File "C:\Python33\lib\site-packages\pkg_resources.py", line 568, in resolve

dist = best[req.key] = env.best_match(req, self, installer)

File "C:\Python33\lib\site-packages\pkg_resources.py", line 806, in best_match

return self.obtain(req, installer) # try and download/install

File "C:\Python33\lib\site-packages\pkg_resources.py", line 818, in obtain

return installer(requirement)

File "C:\Python33\lib\site-packages\setuptools\dist.py", line 313, in fetch_build_egg

return cmd.easy_install(req)

File "C:\Python33\lib\site-packages\setuptools\command\easy_install.py", line 609, in easy_install

return self.install_item(spec, dist.location, tmpdir, deps)

File "C:\Python33\lib\site-packages\setuptools\command\easy_install.py", line 639, in install_item

dists = self.install_eggs(spec, download, tmpdir)

File "C:\Python33\lib\site-packages\setuptools\command\easy_install.py", line 825, in install_eggs

return self.build_and_install(setup_script, setup_base)

File "C:\Python33\lib\site-packages\setuptools\command\easy_install.py", line 1031, in build_and_install

self.run_setup(setup_script, setup_base, args)

File "C:\Python33\lib\site-packages\setuptools\command\easy_install.py", line 1016, in run_setup

run_setup(setup_script, args)

File "C:\Python33\lib\site-packages\setuptools\sandbox.py", line 69, in run_setup

lambda: execfile(

File "C:\Python33\lib\site-packages\setuptools\sandbox.py", line 120, in run

return func()

File "C:\Python33\lib\site-packages\setuptools\sandbox.py", line 71, in

{'__file__':setup_script, '__name__':'__main__'}

File "C:\Python33\lib\site-packages\setuptools\compat.py", line 94, in execfile

exec_(compile(source, fn, 'exec'), globs, locs)

File "setup.py", line 30, in

"Programming Language :: Python :: 2.6",

File "C:\Python33\lib\distutils\core.py", line 109, in setup

_setup_distribution = dist = klass(attrs)

File "C:\Python33\lib\site-packages\setuptools\dist.py", line 239, in init

self.fetch_build_eggs(attrs.pop('setup_requires'))

File "C:\Python33\lib\site-packages\setuptools\dist.py", line 263, in fetch_build_eggs

parse_requirements(requires), installer=self.fetch_build_egg

File "C:\Python33\lib\site-packages\pkg_resources.py", line 568, in resolve

dist = best[req.key] = env.best_match(req, self, installer)

File "C:\Python33\lib\site-packages\pkg_resources.py", line 806, in best_match

return self.obtain(req, installer) # try and download/install

File "C:\Python33\lib\site-packages\pkg_resources.py", line 818, in obtain

return installer(requirement)

File "C:\Python33\lib\site-packages\setuptools\dist.py", line 313, in fetch_build_egg

return cmd.easy_install(req)

File "C:\Python33\lib\site-packages\setuptools\command\easy_install.py", line 609, in easy_install

return self.install_item(spec, dist.location, tmpdir, deps)

File "C:\Python33\lib\site-packages\setuptools\command\easy_install.py", line 639, in install_item

dists = self.install_eggs(spec, download, tmpdir)

File "C:\Python33\lib\site-packages\setuptools\command\easy_install.py", line 825, in install_eggs

return self.build_and_install(setup_script, setup_base)

File "C:\Python33\lib\site-packages\setuptools\command\easy_install.py", line 1031, in build_and_install

self.run_setup(setup_script, setup_base, args)

File "C:\Python33\lib\site-packages\setuptools\command\easy_install.py", line 1019, in run_setup

raise DistutilsError("Setup script exited with %s" % (v.args[0],))

distutils.errors.DistutilsError: Setup script exited with error: SandboxViolation: open('C:\Python33\lib\lib2to3\Grammar3.3.2.final.0.pickle', 'wb') {}

The package setup script has attempted to modify files on your system

that are not within the EasyInstall build area, and has been aborted.

This package cannot be safely installed by EasyInstall, and may not

support alternate installation locations even if you run its setup

script by hand. Please inform the package's author and the EasyInstall

maintainers to find out if a fix or workaround is available.


Cleaning up...

Removing temporary dir c:\users\tom\appdata\local\temp\pip_build_Tom... Command python setup.py egg_info failed with error code 1 in c:\users\tom\appdata\local\temp\pip_build_Tom\irc

Exception information: Traceback (most recent call last): File "C:\Python33\lib\site-packages\pip\basecommand.py", line 134, in main status = self.run(options, args) File "C:\Python33\lib\site-packages\pip\commands\install.py", line 236, in run requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle) File "C:\Python33\lib\site-packages\pip\req.py", line 1134, in prepare_files req_to_install.run_egg_info() File "C:\Python33\lib\site-packages\pip\req.py", line 259, in run_egg_info command_desc='python setup.py egg_info') File "C:\Python33\lib\site-packages\pip\util.py", line 670, in call_subprocess % (command_desc, proc.returncode, cwd)) pip.exceptions.InstallationError: Command python setup.py egg_info failed with error code 1 in c:\users\tom\appdata\local\temp\pip_build_Tom\irc


jaraco commented 8 years ago

I've encountered this issue before. This issue is triggered when Python and lib2to3 tries to expand a pickle in the system directory.

I'm surprised the install of irc is triggering this error because irc doesn't use 2to3.

I worked around this in my environments by first importing lib2to3.grammar (I think) before running any installs. Please try that and let me know if that helps.

Later, I'll have my main workstation and can confirm and investigate further.


Original comment by: Jason R. Coombs

jaraco commented 8 years ago

Ran the following, I assume this is what you meant?

Apologies if not, still new to Python :)

C:\Users\Tom>pip install lib2to3.grammar

Downloading/unpacking lib2to3.grammar

Could not find any downloads that satisfy the requirement lib2to3.grammar

Cleaning up...

No distributions at all found for lib2to3.grammar


Original comment by: Nuvelle

jaraco commented 8 years ago

I apologize. I didn't give very good advice, as I was working from memory.

What I meant was to run

python -c "import lib2to3.pygram"

That will trigger the Python environment to generate the lib2to3 grammar, which it stores as a pickle. If that code gets triggered first as part of installing a package, it will cause that sandbox violation (because writing outside of the sandboxed directory is disallowed).

My guess is if you run the command above, the install will work. It's possible you don't even need to run the command above and that it'll work. I'm not sure why installing httpie works but installing irc doesn't. It could be because irc uses 'setup_requires' requirements.

In any case, it's not a bug with irc. Please let me know if the above command doesn't get things going.


Original comment by: Jason R. Coombs

jaraco commented 8 years ago

I filed setuptools 121 to track the underlying error.


Original comment by: Jason R. Coombs

jaraco commented 8 years ago

Worked perfectly after running the command!

Thank you!!


Original comment by: Nuvelle