PMXBOT Log file Viewer

Help | Karma | Search:

#pypa logs for Friday the 21st of November, 2014

(Back to #pypa overview) (Back to channel listing) (Animate logs)
[03:20:57] <bassface> has anyone ever seen an importerror for pip3? http://pastebin.com/tVFyxMZP
[03:21:10] <bassface> i've tried uninstalling/reinstalling python3 with brew
[03:27:23] <bassface> is there maybe another way to wipe out the pip3 installation?
[10:24:04] <skylite> Hi, I'm on ubuntu 12 and installed pip3. Could someone explain to me what do I need to chmod/chown so i dont have to use pip3 with sudo?
[10:25:34] <skylite> this is always a problem for me and I cant find any sollution
[10:42:49] <mgedmin> use virtualenv!
[10:43:03] <skylite> ok but
[10:43:14] <skylite> still what are the correct permissions for this?
[10:43:36] <mgedmin> no special permission tweaks are necessary to install packages into a virtualenv
[10:43:50] <mgedmin> (pip3 install --user is also an option, but I haven't used it much)
[10:44:40] <skylite> and is there a way to use pip without sudo outside a virtualenv?
[10:49:18] <mgedmin> pip install --user
[10:52:02] <skylite> mgedmin my problem is this: http://pastebin.com/pFnsKHbN
[10:52:14] <skylite> or is this normal?
[10:52:20] <mgedmin> no
[10:52:26] <mgedmin> you somehow ended up with a pip in /usr/local/
[10:53:00] <mgedmin> I'm guessing you did a sudo pip install ... in the past? well, there's a reason that's considered a Bad Idea
[10:53:40] <mgedmin> still, I wonder what sudo pip changes...
[10:53:49] <skylite> i did a sudo apt-get install python3-setuptools and then sudo easy_install pip
[10:53:57] <skylite> easy_install3
[10:54:01] <mgedmin> why would you ever do that?
[10:54:09] <mgedmin> what's wrong with sudo apt-get install python3-pip?
[10:54:25] <mgedmin> check for non-world-readable directories under /usr/local/?
[10:54:33] <mgedmin> lemmesee if I can remember how to use find
[10:54:39] <skylite> E: Unable to locate package python3-pip
[10:54:43] <skylite> its ubuntu 12
[10:55:12] <mgedmin> find /usr/local \! -perm /755 -ls perhaps?
[10:55:22] <mgedmin> 12.04 or 12.10?
[10:56:45] <skylite> http://pastebin.com/eVe82TUn
[10:57:47] <mgedmin> ok, to fix that try sudo chmod -R a+rX /usr/local/lib/python3.2/dist-packages /usr/local/include
[10:57:56] <skylite> to be honest I was just following this: http://askubuntu.com/questions/412178/how-to-install-pip-for-python-3-in-ubuntu-12-04-lts
[10:58:38] <skylite> ooh
[10:58:45] <skylite> mgedmin thx a lot that did it
[11:06:05] <skylite> mgedmin it still fails :/ http://pastebin.com/Wd9vqSt7
[11:06:18] <skylite> pip is running but I cant install anything
[11:06:42] <mgedmin> as a non-root user you don't have permissions to install anything into your system packages
[11:06:45] <mgedmin> use a virtualenv
[11:07:04] <mgedmin> or you can risk sudo pip3 install again if you don't mind possibly breaking your system
[11:08:28] <skylite> so i should do a sudo pip3 install virtualenv
[11:08:37] <skylite> is that ok?
[11:10:25] <mgedmin> let me check
[11:10:43] <mgedmin> actually that's not necessary
[11:10:48] <mgedmin> sudo apt-get install python-virtualenv
[11:10:57] <mgedmin> then virtualenv -p python3 ~/my-env
[11:11:04] <mgedmin> then ~/my-env/bin/pip install flask etc.
[11:15:02] <skylite> isnt virtualenv only for creating a dev environment?
[11:18:08] <mgedmin> it's for not cluttering your sytem-wide python installation with random packages
[11:19:56] <skylite> say I want to write a backupscript in python and for that I use some packages I create a virtualenv for that, write my code etc but if I want to actually run that system-wide, I still have to install the packages it requires system-wide?
[11:23:17] <mgedmin> that's one option
[11:25:19] <skylite> but thats not a good idea so I'm assuming there is a better one?
[11:26:38] <mgedmin> the problem with computers is that there are so many options sometimes it's hard to say which one's the best :/
[11:27:03] <mgedmin> if I were writing a Python backup script, I'd try to depend on Python packages that are already packaged in Ubuntu
[11:27:12] <mgedmin> and maybe package my backup script in a .deb and upload it to a ppa
[11:27:26] <mgedmin> (this is in case I needed a backup script for several servers)
[11:27:50] <skylite> how about a flask site?
[11:27:54] <mgedmin> if I were writing a Python backup script for my own use, I'd probably make it runnable straight out from a github repo
[11:28:17] <mgedmin> if I were writing a webapp/website, I'd make it runnable from a github repo too
[11:28:23] <mgedmin> then clone it in /opt/mysite
[11:28:42] <mgedmin> then run the build which would create a virtualenv co-located in /opt/mysite with all the stuff
[11:28:58] <skylite> what do you mean make it runnable from a github repo?
[11:29:00] <mgedmin> and have a .wsgi script in /opt/mysite that activates the virtualenv before creating the wsgi app object
[11:29:31] <mgedmin> I mean 'git clone ..../myproject && cd myproject && make run' should work, as long as you've got all the necessary system packages
[11:30:02] <mgedmin> (python itself, make, a C compiler in case your project needs pypi packages with C extension modules, dev headers for those -- e.g. libxml/libjpeg etc for Pillow, ...)
[11:30:24] <mgedmin> 'make run' is an approximation
[11:30:24] <skylite> so the git repo should be basically a virtualenv?
[11:30:53] <skylite> I mean I create a virtualenv cd into it and git init...
[11:31:07] <mgedmin> they can share the directory, yes (.gitignore ignores virtualenv's bin/, lib/, local/, include/; a Makefile commited in git does 'virtualenv .' if it doesn't find a bin/pip)
[11:31:34] <mgedmin> e.g. https://github.com/mgedmin/ShoppingList
[11:31:48] <mgedmin> here's my makefile: https://github.com/mgedmin/ShoppingList/blob/master/Makefile
[11:32:20] <skylite> is the makefile created with pip freeze?
[11:32:24] <mgedmin> for production deployments I wouldn't use 'make run', I'd run 'make' to create the virtualenv and install all the requirements the have apache + mod_wsgi actually run the thing
[11:32:37] <mgedmin> requirements.txt is created with pip freeze, the Makefile I wrote by hand
[11:33:01] <mgedmin> (copying and pasting bits between my projects because it's hard to write one from scratch!)
[11:33:30] <mgedmin> this approach has certain downsides (running a build on the production server instead of building on jenkins and then deploying wheels) but I haven't had the time to improve it
[11:34:12] <mgedmin> the point is, if I need two different flask websites on the same server, and one of them needs some 3rd-party package X version 1.0, and the other requires X version 1.2, I don't get conflicts
[11:34:24] <mgedmin> which I would get if I installed everything into the system python
[11:36:55] <skylite> I see
[11:37:33] <skylite> so every site could have its own virtualenv
[11:37:48] <skylite> isnt that somehow inefficient?
[11:39:07] <mgedmin> disk space is cheap these days
[11:39:12] <mgedmin> isolation is good
[11:39:43] <mgedmin> what is perhaps not so good is that you have to keep track of security updates for each virtualenv by hand
[11:39:48] <mgedmin> requires.io might be a useful tool there
[11:46:21] <apollo13> grml, I should have finished my project :(
[11:46:49] <apollo13> had something like this at the django dash 2 or 3 years ago
[12:26:50] <skylite> mgedmin how about this one? https://github.com/spotify/dh-virtualenv
[13:13:07] <mgedmin> looks interesting!
[13:15:19] <skylite> mgedmin if i create a virtualenv and I want to use git should I exclude everything it creates ?
[13:15:30] <mgedmin> yes
[13:16:12] <skylite> and if I do a clone how can I setup the virtualenv?
[13:18:56] <mgedmin> something like cd checkout-dir && virtualenv . && bin/pip install -r requirements.txt
[13:19:16] <mgedmin> (I like make so I have a Makefile do the virtualenv . && bin/pip install steps for me)
[13:19:59] <skylite> huh
[13:20:14] <skylite> how can I write a makefile?
[13:21:23] <mgedmin> you don't have to
[13:21:34] <mgedmin> but, generally, one uses a text editor
[13:22:01] <skylite> I mean are there any docs for that?
[13:22:09] <doismellburning> `info make`
[13:22:28] <doismellburning> but why not just create a virtualenv elsewhere?
[13:23:01] <skylite> wow
[13:23:02] <skylite> ok
[13:23:41] <mgedmin> for simplicity: I like managing a single directory per project
[13:24:12] <mgedmin> and since I never use the activate script I like being able to run commands with bin/foo
[13:24:23] <mgedmin> while I'm in the project's root directory
[13:24:35] <skylite> yea in one single directory sounds good to me too
[13:24:58] <doismellburning> in which case, why not create it in `.virtualenv` and have `/.virtualenv` in your global gitignore
[13:25:33] <mgedmin> I wouldn't have a bin/django etc. if I created the virtualenv in .virtualenv/
[13:25:56] <mgedmin> as for global ignores -- when there are many developers it's better when they don't have to tweak their global config too much
[13:26:03] <mgedmin> so I avoid them
[13:26:14] <mgedmin> unless it's for stuff that's idiosyncratic to my own habits
[13:26:18] <doismellburning> this would be
[13:26:31] <doismellburning> and yes you wouldn't have bin/django, you'd have .virtualenv/bin/django
[13:26:46] <skylite> thats sounds good actually
[13:26:49] <mgedmin> before virtualenv existed I used to use zc.buildout
[13:26:54] <mgedmin> zc.buildout creates scripts in ./bin/
[13:26:57] <mgedmin> I got used to that
[13:27:08] <hynek> hi, is there anything I can do such that running https://github.com/hynek/structlog/blob/master/setup.py using `python setup.py test` doesn’t result in my home directory being polluted by .egg directories? Running tox leads to this beauty: http://i.glui.me/1v24Q01 if I install the deps using pip install directly, it doesn’t happen
[13:27:41] <doismellburning> skylite: it is essentially what I do
[13:27:43] <mgedmin> hynek, "don't use setup.py test" is the best I can offer :/
[13:27:57] <mgedmin> you can use python setup.py test in tox.ini iff you also specify all the test deps in tox.ini
[13:28:09] <mgedmin> then setup.py test will see that they all are already installed and won't clutter your $PWD
[13:28:30] <mgedmin> downside: you have to duplicate your test dependencies in setup.py and tox.ini because there's no API to extract test_requires from a setup.py
[13:28:33] <skylite> doismellburning so when you clone a repo you then create the virtualenv for it in .virtualenv and source that?
[13:28:38] <mgedmin> (this is why people hate setuptools)
[13:29:10] <doismellburning> skylite: I rarely source it, but yes
[13:29:24] <skylite> why?
[13:29:35] <skylite> dont you have to source it in order to use it?
[13:29:39] <doismellburning> skylite: and I have `/.virtualenv` in my global gitignore, so it's ignored by default
[13:29:42] <doismellburning> skylite: no
[13:29:55] <skylite> oh
[13:30:21] <doismellburning> skylite: see mgedmin's comments above
[13:31:21] <mgedmin> you can either . my-virtualenv/activate and then it'll modify $PATH and $PYTHONPATH
[13:31:31] <mgedmin> but that way I open a new terminal tab and I have to remember to activate the same venv
[13:31:44] <dstufft> hynek: if you upgrade your setuptools all that will get put into a single .egg directory
[13:31:48] <skylite> right
[13:31:49] <dstufft> hynek: if you consider that better
[13:31:55] <mgedmin> or you can run my-virtualenv/bin/script using the full (relative) path every time
[13:31:55] <hynek> dstufft: sorta :)
[13:32:07] <dstufft> (to be clear, .egg/Twisted-whatever.egg instead of Twisted-wahtever.egg
[13:32:14] <dstufft> might be .eggs actually
[13:32:16] <dstufft> I forget the name
[13:32:21] <mgedmin> I prefer my shell sessions to be as stateless as possible
[13:33:02] <skylite> that sounds great
[13:33:03] <dstufft> hynek: the other alternative is to write your own test command and install the test dependencies however you want inside of that
[13:33:04] <hynek> dstufft: i saw it somewhere already. i guess it’s differences in my setuptools versions within my venvs
[13:33:12] <hynek> .eggs is fine
[13:33:21] <dstufft> hynek: yea, you just want to be on setuptools 7.0+ then
[13:33:33] <dstufft> virtualenv is using a pretty old setuptools at this point
[13:33:36] <dstufft> 3.6 I think?
[13:34:42] <hynek> my tox is even within a separate venv (via pips)
[13:35:59] <hynek> ugh now I see the problem. tox will create virtualenvs which has their setuptools…
[13:37:15] <dstufft> hynek: add a setuptools dep
[13:37:18] <dstufft> in tox.ini
[13:37:20] <hynek> yep
[13:37:24] <hynek> that’s what i did
[13:37:40] <dstufft> or you can refactor your setup.py so that you have a tests extra as wella s tests_require
[13:37:45] <dstufft> and tell tox to install that
[13:38:13] <hynek> dstufft: https://github.com/hynek/structlog/commit/eed09e122528d167fc8cd0a0f3c2e32f2950bd75
[13:38:23] <hynek> i have tests require
[13:40:13] <hynek> dstufft: anyways, thanks <3
[13:40:27] <dstufft> hynek: no problem :D
[16:02:53] <skylite> how can I know if I have header files and a static library installed for Python?
[18:24:45] <buck1> skylite: try to include/link them
[18:25:11] <buck1> is there any way to retrieve what extras a package was installed with, via pkg_resources?
[18:25:30] <buck1> i can get the list of valid extras, and the requirements given some particular extras
[19:03:22] <buck1> !logs
[19:03:22] <pmxbot> http://chat-logs.dcpython.org/channel/pypa
[20:04:20] <DanielHolth> buck1 no there is not
[20:04:55] <DanielHolth> either the extra dependencies are installed, ore they aren't, but the name of that "extra" is not recorded.
[20:39:09] <buck1> DanielHolth: sad!
[20:40:09] <buck1> thanks for the information though
[21:42:37] <skylite> buck1 how can I include them?
[21:43:48] <buck1> #include
[21:44:06] <buck1> it's C
[21:44:12] <skylite> anyone managed to make vim aware of the virtualenv when doing :py3 % ? I tried it with a plugin but that causes python to crash
[21:45:46] <buck1> skylite: activating before opening vim should work
[21:45:55] <buck1> although i think :py uses the builtin python
[21:46:00] <buck1> embedded*
[21:46:48] <skylite> avtivating before opening vim does net help i tried:(
[21:49:42] <buck1> skylite: don't use :py imo
[21:49:52] <buck1> use :!python instead?
[21:50:52] <skylite> I need python3 i cant use py thats python2
[21:51:21] <skylite> but I guess I just end up calling :! virtualenv/bin/python3 % by hand
[21:51:28] <skylite> that works
[22:00:32] <buck1> skylite: if you have it activated, it's just :!python
[22:00:48] <buck1> perosonally i keep tmux tabs, or hit ctrl+z