When creating the virtualenv, you need to use
virtualenv --system-site-packages
to not fully isolate the virtualenv.

Am 16.12.2014 um 23:38 schrieb Michael Pearce:
> Hi Damien,
>  
> Thanks for your response. I'll try to outline my problem:
>  
> I'm in the process of installing (deploying) a turbogears app (python
> 2.6 framework) to a linux Redhat 6.5 server. The server is not able to
> download packages from the Internet so this is basically an offline
> installation.
>  
> I have transferred all the python packages (mostly in egg format however
> some compressed in .gz format) to the server, created a virtualenv and
> installed each component via pip or easy_install. The postgresql
> database packages have been transferred in rpm format and installed with
> the linux rpm package manager (including
> python-psycopg2-2.4.6-1.rhel6.x86_64.rpm).
>  
> If I launch python from within the activated virtualenv and try to
> import psycopg2, I get an ImportError: No module named psycopg2.
> However, if I do this with deactivate virtualenv the import works fine.
> I have assumed that in order for virtualenv to recognise psycopg2 it
> needs to be installed via pip or easy_install. I have tried to install
> psycopg2 in compressed .gz format (psycopg2-2.5.4.tar.gz) with
> easy_install, however I get errors that appear to indicate that the
> server does not have the necessary tools (gcc compiler) to install the
> package.
>  
> Are you able to recommend a solution for installing psycopg2 within the
> virtualenv. I was thinking that I may need to setup the server with
> capability to compile the .gz package, however it appears that this is
> not straight forward and I would prefer to find an executable package
> (or psgcopy2 egg for python 2.6, if it exists). I recall having a
> similar problem a few years ago with a windows server which was resolved
> by installing an .exe file within the virtualenv. Would appreciate any
> assistance you can provide.
>  
> Thanks, Michael
>  
>  
>  
> 
> On Wednesday, December 17, 2014 1:08:10 AM UTC+11, lebouquetin wrote:
> 
>     Hi Michael,
> 
>     I work with postgresql and always deploy virtualenv/psycopg2. It's a
>     bit long because there are some compilation steps, but it is as easy
>     as pip install psycopg2.
>     What do you mean by "Are you aware of any psycopg2 package that can
>     be installed with pip or easy_install?"
> 
>     Damien
> 
>     Le 15/12/2014 04:28, Michael Pearce a écrit :
>>     Thanks Alessandro, it appears that I have it working now by using
>>     virtualenv. Initially I avoided setting up a virtualenv because I
>>     could not get the postgresql module psycopg2 working. Whilst
>>     psycopg2 is installed in the main python site packages, it is not
>>     recognised by the virtualenv. I think it has something to do with
>>     the fact that I installed it with rpm and not pip or easy_install.
>>     Are you aware of any psycopg2 package that can be installed with
>>     pip or easy_install?
>>      
>>     Thank, Michael
>>      
>>      
>>     On Sunday, December 14, 2014 10:00:40 PM UTC+11, Alessandro Molina
>>     wrote:
>>
>>         As that line is where repoze.what_quickstart creates the
>>         FriendlyForm I suppose it might be something related to
>>         repoze.who-friendlyform installation?
>>
>>         On Sun, Dec 14, 2014 at 5:33 AM, Michael Pearce
>>         <[email protected]> wrote:
>>
>>             I'm getting the following response from 'SUDO PASTER SERVE
>>             --RELOAD DEVELOPMENT.INI' entry:
>>
>>             Operating system: Linux RHEL 6.5
>>
>>             [mpe25@au04uap210qanr2 projects]$ sudo paster serve
>>             --reload development.ini
>>             Starting subprocess with file monitor
>>             /usr/lib/python2.6/site-packages/tw/core/view.py:223:
>>             DeprecationWarning: object.__new__() takes no parameters
>>               obj = object.__new__(cls, *args, **kw)
>>             Traceback (most recent call last):
>>               File "/usr/bin/paster", line 9, in <module>
>>                 load_entry_point('pastescript==1.7.5',
>>             'console_scripts', 'paster')()
>>               File
>>             "/usr/lib/python2.6/site-packages/paste/script/command.py", line
>>             84, in run
>>                 invoke(command, command_name, options, args[1:])
>>               File
>>             "/usr/lib/python2.6/site-packages/paste/script/command.py", line
>>             123, in invoke
>>                 exit_code = runner.run(args)
>>               File
>>             "/usr/lib/python2.6/site-packages/paste/script/command.py", line
>>             218, in run
>>                 result = self.command()
>>               File
>>             "/usr/lib/python2.6/site-packages/paste/script/serve.py",
>>             line 276, in command
>>                 relative_to=base, global_conf=vars)
>>               File
>>             "/usr/lib/python2.6/site-packages/paste/script/serve.py",
>>             line 313, in loadapp
>>                 **kw)
>>               File
>>             "/usr/lib/python2.6/site-packages/paste/deploy/loadwsgi.py",
>>             line 204, in loadapp
>>                 return loadobj(APP, uri, name=name, **kw)
>>               File
>>             "/usr/lib/python2.6/site-packages/paste/deploy/loadwsgi.py",
>>             line 225, in loadobj
>>                 return context.create()
>>               File
>>             "/usr/lib/python2.6/site-packages/paste/deploy/loadwsgi.py",
>>             line 625, in create
>>                 return self.object_type.invoke(self)
>>               File
>>             "/usr/lib/python2.6/site-packages/paste/deploy/loadwsgi.py",
>>             line 110, in invoke
>>                 return fix_call(context.object, context.global_conf,
>>             **context.local_conf)
>>               File
>>             
>> "/usr/lib/python2.6/site-packages/paste/deploy/util/fixtypeerror.py",
>>             line 57, in fix_call
>>                 val = callable(*args, **kw)
>>               File "/opt/tg21/projects/projects/config/middleware.py",
>>             line 35, in make_app
>>                 app = make_base_app(global_conf, full_stack=True,
>>             **app_conf)
>>               File
>>             
>> "/usr/lib/python2.6/site-packages/turbogears2-2.1.5-py2.6.egg/tg/configuration.py",
>>             line 945, in make_base_app
>>                 app = self.add_auth_middleware(app, skip_authentication)
>>               File
>>             
>> "/usr/lib/python2.6/site-packages/turbogears2-2.1.5-py2.6.egg/tg/configuration.py",
>>             line 713, in add_auth_middleware
>>                 app = setup_sql_auth(app,
>>             skip_authentication=skip_authentication, **auth_args)
>>               File
>>             
>> "/usr/lib/python2.6/site-packages/repoze.what_quickstart-1.0.9-py2.6.egg/repoze/what/plugins/quickstart/__init__.py",
>>             line 283, in setup_sql_auth
>>                 charset=charset,
>>             TypeError: __init__() got an unexpected keyword argument
>>             'charset'
>>             [mpe25@au04uap210qanr2 projects]$
>>
>>             Can someone please advise what is going on?
>>
>>             Thanks,
>>             Michael
>>
>>             -- 
>>             You received this message because you are subscribed to
>>             the Google Groups "TurboGears" group.
>>             To unsubscribe from this group and stop receiving emails
>>             from it, send an email to [email protected].
>>             To post to this group, send email to
>>             [email protected].
>>             Visit this group at
>>             http://groups.google.com/group/turbogears
>>             <http://groups.google.com/group/turbogears>.
>>             For more options, visit https://groups.google.com/d/optout
>>             <https://groups.google.com/d/optout>.
>>
>>     -- 
>>     You received this message because you are subscribed to the Google
>>     Groups "TurboGears" group.
>>     To unsubscribe from this group and stop receiving emails from it,
>>     send an email to [email protected] <javascript:>.
>>     To post to this group, send email to [email protected]
>>     <javascript:>.
>>     Visit this group at http://groups.google.com/group/turbogears
>>     <http://groups.google.com/group/turbogears>.
>>     For more options, visit https://groups.google.com/d/optout
>>     <https://groups.google.com/d/optout>.
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "TurboGears" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to [email protected]
> <mailto:[email protected]>.
> To post to this group, send email to [email protected]
> <mailto:[email protected]>.
> Visit this group at http://groups.google.com/group/turbogears.
> For more options, visit https://groups.google.com/d/optout.

-- 
Moritz Schlarb

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/turbogears.
For more options, visit https://groups.google.com/d/optout.

Reply via email to