Opened 8 years ago

Last modified 8 years ago

#51678 assigned defect

yum @3.2.29_1 Cannot import yum module in python after install

Reported by: aszostak-partner-eso-org Owned by:
Priority: Normal Milestone:
Component: ports Version: 2.3.4
Keywords: Cc: afb@…
Port: yum

Description

I would expect that after installing the yum port that I should be able to import the module within python. However this fails. See below:

macosx-10-9:~ vagrant$ sudo port install yum
--->  Computing dependencies for yum
...
--->  Cleaning yum
--->  Scanning binaries for linking errors
--->  No broken files found.
macosx-10-9:~ vagrant$ which python
/opt/local/bin/python
macosx-10-9:~ vagrant$ python
Python 2.7.11 (default, Mar  1 2016, 18:08:21) 
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import yum
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named yum
>>>

It appears that the yum port installs the module under:

/opt/local/lib/python/site-packages

rather than the following path where all other python 2.7 packages appear to be installed:

/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages

Change History (5)

comment:1 Changed 8 years ago by mf2k (Frank Schima)

What is the output of the following?

ls -l /opt/local/bin/python

comment:2 Changed 8 years ago by aszostak-partner-eso-org

I get:

macosx-10-9:~ vagrant$ ls -l /opt/local/bin/python
lrwxr-xr-x  1 root  admin  24 Jun 21 03:09 /opt/local/bin/python -> /opt/local/bin/python2.7

comment:3 Changed 8 years ago by mf2k (Frank Schima)

Cc: n3npq@… removed
Owner: changed from macports-tickets@… to n3npq@…

comment:4 Changed 8 years ago by afb@…

Most likely it is hardcoded to lib/python somewhere.

PYVER := $(shell $(PYTHON) -c 'import sys; print "%.3s" %(sys.version)')
PYSYSDIR := $(shell $(PYTHON) -c 'import sys; print sys.prefix')
PYLIBDIR = $(PYSYSDIR)/lib/python$(PYVER)
PKGDIR = $(PYLIBDIR)/site-packages/$(PACKAGE)

It is not meant to be portable, whatsoever.

Last edited 8 years ago by afb@… (previous) (diff)

comment:5 Changed 8 years ago by kurthindenburg (Kurt Hindenburg)

Owner: n3npq@… deleted
Status: newassigned
Note: See TracTickets for help on using tickets.