Trying to figure out virtualenv and Spyder and failing.

1,784 views
Skip to first unread message

vbgunz

unread,
Apr 20, 2012, 10:23:15 AM4/20/12
to spyd...@googlegroups.com
I installed pyramid in a virtual environment using virtualenv. Manually going into the terminal and launching the interpreter, I am able to use pyramid successfully. I am just not able to get Spyder to auto complete a namespace. I've done the following steps.

1. Create a virtual environment using virtualenv (--no-site-packages)
2. Tools > Preferences > Console > Advanced Settings (point interpreter to virtual environment's python executable)
3. Tools > Update Module Name List
4. Restart Spyder

I still can't get auto complete to work. I am using Spyder 2.1.6 provided by official Fedora repositories on Fedora 16. I don't want to report this as a bug as I believe I am missing something, just not sure what it is. Can someone please help?

Carlos Córdoba

unread,
Apr 22, 2012, 2:33:11 PM4/22/12
to spyd...@googlegroups.com
Hi,

It seems that you've done everything right. Maybe the problem is in the
--no-site-packages flag to virtualenv. What happens if you don't use it?

Cheers,
Carlos

El 20/04/12 09:23, vbgunz escribió:

> --
> You received this message because you are subscribed to the Google
> Groups "spyder" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/spyderlib/-/rMRljarwpkAJ.
> To post to this group, send email to spyd...@googlegroups.com.
> To unsubscribe from this group, send email to
> spyderlib+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/spyderlib?hl=en.

vbgunz

unread,
Apr 22, 2012, 2:46:12 PM4/22/12
to spyd...@googlegroups.com
When I change the interpreter in console > advanced settings and update the module list, pyramid namespaces do not automatically complete but the rest of the standard library does. With or without the --no-site-packages flag, everything still automatically completes in both virtual environments *but* pyramid does not complete at all (unless I add it to PYTHONPATH). I am still new to virtualenv but was under the impression that as long as I used virtualenv to install pyramid into a virtual environment, I would not need to mess with PYTHONPATH at all. Am I wrong?

> spyderlib+unsubscribe@googlegroups.com.

Carlos Córdoba

unread,
Apr 22, 2012, 2:49:04 PM4/22/12
to spyd...@googlegroups.com
I'll take a look at it. It should work after selecting the virtualenv interpreter, so probably this is a bug on our side. I'll come back to you in a couple of days.

Cheers,
Carlos

El 22/04/12 13:46, vbgunz escribió:
To view this discussion on the web visit https://groups.google.com/d/msg/spyderlib/-/ZBSeM8663pMJ.

To post to this group, send email to spyd...@googlegroups.com.
To unsubscribe from this group, send email to spyderlib+...@googlegroups.com.

vbgunz

unread,
Apr 22, 2012, 2:55:40 PM4/22/12
to spyd...@googlegroups.com
Thank you Carlos,

I appreciate your time. Still looking forward to a much better and more enhanced object inspector :)

Carlos Córdoba

unread,
Apr 23, 2012, 10:24:29 AM4/23/12
to spyd...@googlegroups.com
Hi,

I just tested this and these are my findings:

1. I'm getting completions for pyramid on the Console (python and IPython) but I had to use the --system-site-packages flag when creating the virtualenv. (I'm using virtualenv 1.7)

2. Completions don't work on the Editor because we're not using the venv interpreter to get them. So we have to fix this one.

3. If you want to get completions on the Console *and* the Editor, you have start Spyder with the venv interpreter. To do it you have to:

a) Download Spyder sources (2,1 or 2.2dev should work the same)

b) Unpack them in your dir of choice

c) Activate your venv (either with 'workon' (easier) or 'activate')

d) cd into your Spyder sources dir

e) Run spyder with:

python bootstrap.py

I know it's a bit cumbersome but at least it will let you have your work done until we fix number 2.

Cheers,
Carlos

El 22/04/12 13:55, vbgunz escribió:
To view this discussion on the web visit https://groups.google.com/d/msg/spyderlib/-/XVno9x7SSvQJ.

To post to this group, send email to spyd...@googlegroups.com.
To unsubscribe from this group, send email to spyderlib+...@googlegroups.com.

vbgunz

unread,
Apr 24, 2012, 10:49:52 AM4/24/12
to spyd...@googlegroups.com

Hello Carlos,


Here are my findings. I can get the editor and console to both auto complete namespaces on both Fedora's (2.1.6) and Spyder 2.1.9 by doing the following.


Both versions require --system-site-packages

Both versions require changing the interpreter in console > advanced settings.

I've updated the module list after changing the interpreter

I've restarted both versions whether I needed to or not

I've activated the venv and used its interpreter


For Spyder 2.1.6 (Fedora)

python /usr/lib/python2.7/site-packages/spyderlib/spyder.py

or python -m spyderlib.spyder


For Spyder 2.1.9 (source)

I've only tried your suggestion of launching through bootstrap.py (successful)


Both versions seem to successfully complete namespaces for pyramid, in the editor and console.


I am still quite new to virtualenv but got to thinking it would be very nice if this was somehow easier in spyder. It's off topic for this discussion I guess but I seem to have things working. Thank you Carlos for the help. It's appreciated!

Reply all
Reply to author
Forward
0 new messages