Skip to content
Advertisement

python 3.x no module named sqlalchemy after installation

I’m trying to install sqlalchemy to interact with mysql database for my python 3.x with ubuntu 12.04, but then when I import the sqlalchemy it says no module named sqlalchemy. This is what i did with installation:

aoi@aoi:~$ sudo apt-get install python3-sqlalchemy
[sudo] password for aoi: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
libgio-cil libmono-corlib4.0-cil libmono-system-security4.0-cil libmono-system-xml4.0-  cil libmono-i18n-west4.0-cil cli-common guile-1.8-libs
libmono-system-configuration4.0-cil librhythmbox-core5 mono-runtime libgdu-gtk0  libavahi-ui-gtk3-0 mono-4.0-gac mono-gac
linux-headers-3.5.0-23-generic libglib2.0-cil linux-headers-3.5.0-23 libming1 thunderbird-globalmenu libmusicbrainz3-6 libmono-i18n4.0-cil
libmono-security4.0-cil libmono-system4.0-cil
Use 'apt-get autoremove' to remove them.
 Suggested packages:
 python-sqlalchemy-doc
 The following NEW packages will be installed:
 python3-sqlalchemy
 0 upgraded, 1 newly installed, 0 to remove and 81 not upgraded.
 Need to get 450 kB of archives.
 After this operation, 2,808 kB of additional disk space will be used.
 Get:1 http://ph.archive.ubuntu.com/ubuntu/ precise-updates/main python3-sqlalchemy all   0.7.4-1ubuntu0.1 [450 kB]
 Fetched 450 kB in 40s (11.0 kB/s)                                                                                                                    
 Selecting previously unselected package python3-sqlalchemy.
 (Reading database ... 346102 files and directories currently installed.)
 Unpacking python3-sqlalchemy (from .../python3-sqlalchemy_0.7.4-1ubuntu0.1_all.deb) ...
 Setting up python3-sqlalchemy (0.7.4-1ubuntu0.1) ...

Did I do something wrong?

Advertisement

Answer

By using apt-get you have installed sqlalchemy in the default directory for Ubuntu’s default Python 3, which is 3.2. If you search in the directory /usr/lib/python3/dist-packages you’ll find the sqlalchemy module (or just type locate sqlalchemy). However, this isn’t where a custom Python will look for its modules. You’ll need to download the source and compile it with the correct Python, something like /opt/python3.3/bin/python3.3 setup.py install in the source directory for sqlalchemy. See the instructions here: http://docs.python.org/3.3/install

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement