Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing enhancement: Test pip install #39

Open
cool-RR opened this issue Apr 24, 2019 · 13 comments
Open

Testing enhancement: Test pip install #39

cool-RR opened this issue Apr 24, 2019 · 13 comments

Comments

@cool-RR
Copy link
Owner

cool-RR commented Apr 24, 2019

@bittner , this is right up your alley so if you'll feel like doing it, it'll be cool.

It'll be nice if after every release, or after every push to master, there will be separate tests that do pip install pysnooper on all platforms and run the tests. This is to rule out any errors in the installation.

@bittner
Copy link
Collaborator

bittner commented Apr 24, 2019

Every Python environment created by Tox gets pysnooper installed. The workflow is roughly:

  1. Create virtualenv for Python x.y (e.g. Python 3.7 for py37)
  2. Run python setup.py install (i.e. install pysnooper)
  3. Install the dependencies (from deps = ... in the Tox environment)
  4. Run pytest (i.e. from commands = ...)

If I'm not completely mistaken pip install pysnooper does nothing else than download the package from PyPI and run python setup.py install. Hence, in theory installing should succeed when Tox runs successfully. And this is now ensured.

Any doubt about this?

@bittner
Copy link
Collaborator

bittner commented Apr 24, 2019

What is missing indeed is that tests are run on Windows and macOS. We've done this with PythonTurtle already, it's tedious but it's feasible, it's not magic.

And more tests, e.g. integration tests, are always a good idea. Sure!

@cool-RR
Copy link
Owner Author

cool-RR commented Apr 24, 2019

Are you sure tox does setup.py install? Where is it written?

@bittner
Copy link
Collaborator

bittner commented Apr 25, 2019

You may want to take a look at the Tox System Overview and the related explanations in the Tox documentation.

@cool-RR
Copy link
Owner Author

cool-RR commented Apr 25, 2019

Okay, thanks. I'd still welcome a direct test of pip install pysnooper. Low priority.

@cool-RR cool-RR changed the title Feature request: Test pip install Testing enhancement: Test pip install Apr 27, 2019
@enadol
Copy link

enadol commented Apr 27, 2019

On Ubuntu/Raspbian, pip install pysnooper shoots the following:

pi@raspberrypi:~ $ pip3 install pysnooper
Downloading/unpacking pysnooper
Downloading PySnooper-0.0.22-py2.py3-none-any.whl
Installing collected packages: pysnooper
Cleaning up...
Exception:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/usr/lib/python3/dist-packages/pip/commands/install.py", line 295, in run
requirement_set.install(install_options, global_options, root=options.root_path)
File "/usr/lib/python3/dist-packages/pip/req.py", line 1436, in install
requirement.install(install_options, global_options, *args, **kwargs)
File "/usr/lib/python3/dist-packages/pip/req.py", line 672, in install
self.move_wheel_files(self.source_dir, root=root)
File "/usr/lib/python3/dist-packages/pip/req.py", line 902, in move_wheel_files
pycompile=self.pycompile,
File "/usr/lib/python3/dist-packages/pip/wheel.py", line 214, in move_wheel_files
clobber(source, lib_dir, True)
File "/usr/lib/python3/dist-packages/pip/wheel.py", line 204, in clobber
os.makedirs(destdir)
File "/usr/lib/python3.4/os.py", line 237, in makedirs
mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/usr/local/lib/python3.4/dist-packages/pysnooper'

Storing debug log for failure in /home/pi/.pip/pip.log

All this on a Rasbberry Pi

@cool-RR
Copy link
Owner Author

cool-RR commented Apr 27, 2019

@enadol :

  1. Please move this to a new issue.
  2. Please confirm that you can install other packages via pip, and show the output

@enadol
Copy link

enadol commented Apr 27, 2019

On a Windows machine with Anaconda, pip install pysnooper worked just fine:

image

I posted these messages in response to the request of testing pip install pysnooper. I wasn't trying to report the issue in Ubuntu per se. Sorry if it bothered.

@bittner
Copy link
Collaborator

bittner commented Apr 27, 2019

@enadol: This behavior is normal on any GNU/Linux system.

PermissionError: [Errno 13] Permission denied: '/usr/local/lib/python3.4/dist-packages/pysnooper'

The error says, you - user pi - are not allowed to write in areas that require elevated privileges (read: administrator access, i.e. root). Note that this is fine, it makes it more difficult for attackers that manage to enter your Raspberry Pi via an unprivileged account to do harm to your machine.

On Windows you may be used to work with an administrator-level user. This allows you to install programs anywhere, which makes your system insecure by default.

TL;DR - How install a Python package?

You have two options to install Python packages on GNU/Linux. As a super-user or in your userspace.

$ sudo pip3 install pysnooper

This will prompt you for your user password (and requires the user to be in the sudo group). If sudo is not installed use su and enter the root user's password:

$ su -c "pip3 install pysnooper"

Installing in your userspace requires no special privileges:

$ pip3 install --user pysnooper

It makes packages available in ~/.local/lib/ and scripts in ~/.local/bin/ (just in case this is not in your PATH by default).

@enadol
Copy link

enadol commented Apr 27, 2019

Great! Thanks a lot! Cheers!

@angrydead
Copy link

Does anyone mind if I pick this one up? It seems like a good first issue to tackle for new contributors.

@cool-RR
Copy link
Owner Author

cool-RR commented Apr 29, 2019 via email

@angrydead
Copy link

With the existing automation that's already in place with tox and travis, I think the solution was easier to implement than originally thought--unless I'm missing something?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants