This forum is no longer active. Please post your questions to our new community site

Forums Trac

Trac Stack with PostgreSQL please

Subscribe to Trac Stack with PostgreSQL please 16 post(s), 5 voice(s)

 
Avatar yetangye 7 post(s)

I like BitNami’s Trac Stack,
It’s very simple and nice, Thanks a lot.

But…It use SQLite as database backends…

Would you supply a Trac Stack with PostgreSQL or an PostgreSQL addon for Trac Stack(Just like the PostgreSQL addon for WAMP Stack)

 
Avatar yetangye 7 post(s)

I installed a Postgresql 8.4.2-1, and
(1) install psycopg2 by easy_install
(2) modify trac project’s trac.ini, set database = postgres://postgres:password@localhost/MyPrj
(3) restart Trac Stack’s apache service
and access trac project by browser, I got the error below.


Traceback (most recent call last):
File “c:\portserv\bitnamitracstack\trac\lib\site-packages\Trac-0.11.6-py2.5.egg\trac\web\api.py”, line 377, in send_error
‘text/html’)
File “c:\portserv\bitnamitracstack\trac\lib\site-packages\Trac-0.11.6-py2.5.egg\trac\web\chrome.py”, line 733, in render_template
message = req.session.pop(‘chrome.%s.%d’ % (type_, i))
File “c:\portserv\bitnamitracstack\trac\lib\site-packages\Trac-0.11.6-py2.5.egg\trac\web\api.py”, line 195, in getattr
value = self.callbacks[name](self)
File “c:\portserv\bitnamitracstack\trac\lib\site-packages\Trac-0.11.6-py2.5.egg\trac\web\main.py”, line 265, in _get_session
return Session(self.env, req)
File “c:\portserv\bitnamitracstack\trac\lib\site-packages\Trac-0.11.6-py2.5.egg\trac\web\session.py”, line 155, in init
self.get_session(sid)
File “c:\portserv\bitnamitracstack\trac\lib\site-packages\Trac-0.11.6-py2.5.egg\trac\web\session.py”, line 176, in get_session
super(Session, self).get_session(sid, authenticated)
File “c:\portserv\bitnamitracstack\trac\lib\site-packages\Trac-0.11.6-py2.5.egg\trac\web\session.py”, line 51, in get_session
db = self.env.get_db_cnx()
File “c:\portserv\bitnamitracstack\trac\lib\site-packages\Trac-0.11.6-py2.5.egg\trac\env.py”, line 285, in get_db_cnx
return DatabaseManager(self).get_connection()
File “c:\portserv\bitnamitracstack\trac\lib\site-packages\Trac-0.11.6-py2.5.egg\trac\db\api.py”, line 90, in get_connection
connector, args = self._get_connector()
File “c:\portserv\bitnamitracstack\trac\lib\site-packages\Trac-0.11.6-py2.5.egg\trac\db\api.py”, line 134, in _get_connector
raise TracError(connector.error)
TracError: Cannot load Python bindings for PostgreSQL
-———————————————————————————————————

Then I compiled a psycopg2 egg file by VC++ 2003/Python 2.5/PostgreSQL 8.4.2-1 and install this egg file as C:\PortServ\BitNamiTracStack\python\Lib\site-packages\psycopg2-2.0.13-py2.5-win32.egg, and add “./psycopg2-2.0.13-py2.5-win32.egg” to easy-install.pth.

The attatchment for the egg file.

Can somebody tell me why?
Then restart the apache service, but I still got the error message above.

 

Attached Files

 
Avatar yetangye 7 post(s)

I launch python.exe in cmd.exe, then type “import psycopg2”, “LIBPQ.dll missing” dialog came out.
The I add the C:\PortServ\BitNamiTracStack\pgsql\bin into system’s PATH, restart apache service,
and I still got the error :
TracError: Cannot load Python bindings for PostgreSQL

 
Avatar Beltrán Rueda Administrator 3,714 post(s)

Thanks for your suggestion, we will add in our TO DO list. About the problem that you are reporting, the Stacks do not modify the system environment. We add the environment variables in the /scripts/setenv.bat file. Could you check to add the PostgreSQL variables into this file?

 
Avatar yetangye 7 post(s)

beltran, Thanks, Thanks for Ur reply!
Sorry, I am busy recently and did not watched this thread until today.

I added PostgreSQL’s bin and lib folder to the /scripts/setenv.bat,
then launched use_trac.bat, type “python” , then type “import psycopg2”, it Finished OK.

But then I restart the Apache service, the browser still return the error below:
“TracError: Cannot load Python bindings for PostgreSQL”

Would U tell me what PostgreSQL variables should be add into /scripts/setenv.bat?

BTW, My PostgreSQL instance is not one by PostgerSQL installer.
I download the PostgreSQL zip, unzip it, add an postgres user and init an DB, launch the DB instance by command below:
“runas /noprofile /env /user:postgres C:\PortServ\BitNamiTracStack\pgsql\bin\pg_ctl” -w -D “C:/PortServ/BitNamiTracStackData/pgs” start"

Thanks a lot!

 
Avatar Beltrán Rueda Administrator 3,714 post(s)

Try the following: copy the libpq.dll into the Apache2/bin folder and ensure that this module is enabled in the apache2/conf/httpd.conf file. Then restart the Apache server. i hope it helps.

 
Avatar yetangye 7 post(s)

I copied the libpq.dll into the Apache2/bin, restart apache service,
and the error still.

OK, Thank U very much.
I would like to wait BitNami release the Trac Stack with PostgreSQL with pleasure :)

 
Avatar manuel_b 1 post

Hi,
there is more then only the libpq file which has to be added.

We used Dependency Walker from sysinternals and Process Monitor to see which files where missing. In the end we added the PostgreSQL bin library to the path. Further some openssl dlls are needed like ssleay32.dll and libssl… when I remember correctly.

Process Monitor http://technet.microsoft.com/de-de/sysinternals…
Dependency Walker http://www.dependencywalker.com/

Hope that helps. If not you can buy commercial support from us at www.elego.de

Have a good time
Manuel

 
Avatar asv128 4 post(s)

Hi, I have the same error on Bitnami Trac 0.12.2, Windows Server 2008 64 bit. When will PostgreSQL be supported?

Creating and Initializing Project
Initenv for ‘C:\inetpub\LocalUser\icrc_trac\httpdocs\projects\icrc_salyoshin_ScriptRecorder’ failed.
Failed to create environment.
Cannot load Python bindings for PostgreSQL
Traceback (most recent call last):
File “build\bdist.win32\egg\trac\admin\console.py”, line 422, in do_initenv options=options)
File “build\bdist.win32\egg\trac\env.py”, line 213, in init self.create(options)
File “build\bdist.win32\egg\trac\env.py”, line 401, in create DatabaseManager(self).init_db()
File “build\bdist.win32\egg\trac\db\api.py”, line 145, in init_db connector, args = self.get_connector()
File “build\bdist.win32\egg\trac\db\api.py”, line 195, in get_connector raise TracError(connector.error)
TracError: Cannot load Python bindings for PostgreSQL

 
Avatar victoria Administrator 134 post(s)

Hi,

Are you using the latest BitNami Trac Stack? It is 0.12.2-1. I tried the following and worked for me:

1.- Install PostgreSQL (using the official installer)
2.- Download “psycopg2:http://www.stickpeople.com/projects/python/win-psycopg/psycopg2-2.4.1.win32-py2.6-pg9.0.4-release.exe”. Install it with:
\python\scripts\easy_install.exe \path\to\psycopg2-xxxx.exe
3.- Check that psycopg2 have been correctly installed. Execute “python” and then “import psycopg2” you should not see any error.
4.- Create the trac project.
5.- Restart apache.

 
Avatar asv128 4 post(s)

Victoria, thanks for reply, I am using trac version 0.12.2 and Python 2.5. I have downloaded and installed http://www.stickpeople.com/projects/python/win-… and now I have error in browser:
Cannot load Python bindings for PostgreSQL

and “python” >> “psycopg2” shows error also:
>>> psycopg2
Traceback (most recent call last):
File “”, line 1, in
NameError: name ‘psycopg2’ is not defined
>>>

Any ideas?
Thanks, Sergey

 
Avatar Beltrán Rueda Administrator 3,714 post(s)

Could you try to run the following in the Python console?

>>> import psycopg2

 
Avatar asv128 4 post(s)

Yes, I tried, and it helped. I don’t get error “NameError: name ‘psycopg2’ is not defined”. But error in browser still persists. I restarted apache many times, removed and added a project, it did not help. How does trac get ‘bindings’ to postgresql module? May be I need to add some entry to file with list of bindings?
Thanks, Sergey

 
Avatar victoria Administrator 134 post(s)

You should not need anything else. Which version of PostgreSQL are you using? For the psycop2 that you are using you should have PostgreSQL 9.0.4 installed. Are you using the official installer of PostgreSQL?

You mention that you don’t have any error when you execute “import psycopg2”. Does the creation of new project with trac-admin works for you? Do you still get the same error?

 
Avatar asv128 4 post(s)

>> Are you using the official installer of PostgreSQL?
Yes, Im using official installer, version 9.0.4. I have reinstalled PostgreSQL, it did not help. I have removed and added a project using ‘initenv’, it did not help me, too.
Console output was:


Project environment for ‘ScriptRecorder’ created.
You may now configure the environment by editing the file:
C:\Users\icrc_trac\BitNami Trac Stack projects\icrc_salyoshin_ScriptRecorder\conf\trac.ini
If you’d like to take this new project environment for a test drive, try running the Trac standalone web server `tracd`:

tracd —port 8000 C:\Users\icrc_trac\BitNami Trac Stack projects\icrc_salyoshin_ScriptRecorder

Then point your browser to http://localhost:8000/icrc_salyoshin_ScriptReco….
…..

I tried tracd, browser does not open project page, error is “404 not found”.

Also, result of ‘psycopg2’ check in Python CLI is following:
Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit (Intel)] on win32
Type “help”, “copyright”, “credits” or “license” for more information.
>>> psycopg2
Traceback (most recent call last):
File “”, line 1, in
NameError: name ‘psycopg2’ is not defined
>>> import psycopg2
>>> psycopg2
<module ‘psycopg2’ from ‘C:\Program Files\BitNami Trac Stack\python\lib\site-pac
kages\psycopg2-2.4.1-py2.5-win32.egg\psycopg2\init.pyc’>
>>>

You can see that ‘psycopg2’ command does not work without ‘import psycopg2’. It means that ‘psycopg2’ module is not imported by default. How can I make apache import psycopg2?

 
Avatar victoria Administrator 134 post(s)

Hi,

I think the problem is in how you are creating the project. It seems that the psycopg2 module installed correctly. Can you post the details of how are you creating it?

Thanks.

Forums Trac