Uncategorized

How to Establish Psycopg2 on OSX

Because my Lenovo X1 Carbon died this week (what the hell – non working adaptive keyboard, ghost screen effect and finally damaged mother-board !!!), I have to work with iMac a few days because there was no other Win pc in the office (And it is very painful and hard task if you want to be productive).

Mono is working correctly, Python is working correctly, but as on Windows, psycopg2 is NOT working correctly after installation and there must be done additional steps to make it working.

Note: PostgreSql must be installed. In this tutorial I have installed last version 9.4.

Possible problems:

  • First when I tried pip install psycopg2, there was following error:

Error:  pg_config executable not found.

Solution: activate virtualenv you want to use and run following command. It adds path to PostgreSql bin folder where is situated pg_config file.

PATH=$PATH:/Library/PostgreSQL/9.4/bin/
  • When I run project where was psycopg2 imported, I got:

ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/psycopg2/_psycopg.so Library libssl.1.0.0.dylib Library libcrypto.1.0.0.dylib

Solution: run following commands to create symlinks to needed libs. If the symlinks already exist, remove them first (or rename them to have backup).

# first make backup
sudo mv /usr/lib/libssl.1.0.0.dylib /usr/lib/libssl.1.0.0.dylib.old
sudo mv /usr/lib/libcrypto.1.0.0.dylib /usr/lib/libcrypto.1.0.0.dylib.old
# create new symlinks
sudo ln -s /Library/PostgreSQL/9.4/lib/libssl.1.0.0.dylib /usr/lib/libssl.1.0.0.dylib
sudo ln -s /Library/PostgreSQL/9.4/lib/libcrypto.1.0.0.dylib /usr/lib/libcrypto.1.0.0.dylib
  • Then I run the app again and obtained:

ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/psycopg2/_psycopg.so, 2): Symbol not found: _lo_lseek64 Referenced from: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/psycopg2/_psycopg.so Expected in: /usr/lib/libpq.5.dylib in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/psycopg2/_psycopg.so

Solution: Run following commands to backup actual symlink and make correct one.

# first make backup
sudo mv /usr/lib/libpq.5.dylib /usr/lib/libpq.5.dylib.old
# create new symlinks
sudo ln -s /Library/PostgreSQL/9.4/lib/libpq.5.dylib /usr/lib

And now, it should work correctly!

Advertisement
Uncategorized

Config Transformation Version 1.3.6.0 and Code Completion 1.0.0.9 Released

In both extensions, there is a hotfix of the extension dependency.

There has been set dependency to .NET framework 4.5 which caused that it was not possible to install the extension although the framework was correctly installed. I have found this problem on machine with all frameworks up to 4.6 and Visual Studio 2013. In Visual Studio 2015 there was no problem with the installation. It is strange but I have found similar issue on the internet.

Enjoy it!

Uncategorized

For next generations: MongoDb installation on Windows

Although MongoDb has a msi package for Windows machines, it does not provide automatic configuration as Windows Service. There is a manual, but for me it was not so clear, so here is tutorial for next generations:

  • Download and install MongoDb
  • Create a file mongod.config in {MongoInstallationPath}/bin/ with following content:
systemLog:
     destination: file
     path: D:\data\log\mongod.log
storage:
     dbPath: D:\data\db

Note: You can change location of these folders, but you have to create them before running the following command

  • Run following command from command line as an administrator:

Note: path to config file must be absolute

"{mongoInstallationPath}\bin\mongod.exe" --config "{mongoInstallationPath}\bin\mongod.config" --install
  • Open Windows Services (search services.msc in Start menu), look for MongoDb service and start it. It should be configured to start automatically by default