This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: ImportError: No module named binascii
Type: crash Stage: resolved
Components: Library (Lib) Versions: Python 3.2, Python 2.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: Ramchandra Apte, akuchling, eric.araujo, liuqianhn, loewis
Priority: normal Keywords:

Created on 2012-03-07 07:47 by liuqianhn, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (10)
msg155055 - (view) Author: Qian Liu (liuqianhn) Date: 2012-03-07 07:47
File "~/PythonInstall/lib/python2.7/multiprocessing/process.py", line 129, in start
    from .forking import Popen
  File "~/PythonInstall/lib/python2.7/multiprocessing/forking.py", line 58, in <module>
    from pickle import Pickler
  File "~/PythonInstall/lib/python2.7/pickle.py", line 1266, in <module>
    import binascii as _binascii
ImportError: No module named binascii


The used OS is: [GCC 3.4.6 20060404 (Red Hat 3.4.6-9)] on linux2

NOTED: There is no error when I import "binascii" in Python 2.7.2 on Window XP.

How to solve it?
Many thanks.
msg155057 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2012-03-07 08:23
You probably did something wrong when installing Python. How exactly did you get it into ~/PythonInstall?
msg155060 - (view) Author: Qian Liu (liuqianhn) Date: 2012-03-07 08:48
Dear Martin,

Thanks for your reply.

I went to the folder of python after "tar -zxvf Python-2.7.2.tgz" and do
the following operations:
./configure --prefix="~/PythonInstall"
make
make install
where "~" represent the path in my computer and it is long in the report;
so, I replaced it by ~.

Then, I put "~/PythonInstall"bin
and "~/PythonInstall/lib/python2.7/"site-packages into PATH and PYTHONPATH.

Anything wrong here?

Thanks for your help.

Best regards,
Qian Liu

On Wed, Mar 7, 2012 at 4:23 PM, Martin v. Löwis <report@bugs.python.org>wrote:

>
> Martin v. Löwis <martin@v.loewis.de> added the comment:
>
> You probably did something wrong when installing Python. How exactly did
> you get it into ~/PythonInstall?
>
> ----------
> nosy: +loewis
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <http://bugs.python.org/issue14216>
> _______________________________________
>
>
msg155063 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2012-03-07 09:06
There are some minor errors indeed: the syntax for PATH and PYTHONPATH is wrong (don't use quotes (") in the middle of the value). Also, putting site-packages into PYTHONPATH should not be necessary.

I think the main cause might be the incorrect --prefix argument. Don't use "~/PythonInstall", but "$HOME/PythonInstall". Also, when I try this, I get

configure: error: expected an absolute directory name for --prefix: ~/PythonInstall

so you must have made something different (or you have used a shell different from bash), else you would have gotten the same error.
msg155064 - (view) Author: Qian Liu (liuqianhn) Date: 2012-03-07 09:12
Dear Martin,

Many thanks for your help and your reply. I will correct the errors and let
you know the result.

best regards,
Qian Liu

On Wed, Mar 7, 2012 at 5:07 PM, Martin v. Löwis <report@bugs.python.org>wrote:

>
> Martin v. Löwis <martin@v.loewis.de> added the comment:
>
> There are some minor errors indeed: the syntax for PATH and PYTHONPATH is
> wrong (don't use quotes (") in the middle of the value). Also, putting
> site-packages into PYTHONPATH should not be necessary.
>
> I think the main cause might be the incorrect --prefix argument. Don't use
> "~/PythonInstall", but "$HOME/PythonInstall". Also, when I try this, I get
>
> configure: error: expected an absolute directory name for --prefix:
> ~/PythonInstall
>
> so you must have made something different (or you have used a shell
> different from bash), else you would have gotten the same error.
>
> ----------
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <http://bugs.python.org/issue14216>
> _______________________________________
>
>
msg155066 - (view) Author: Qian Liu (liuqianhn) Date: 2012-03-07 09:35
Dear Martin,

I did the following operations
./configure --prefix=
"/img01/home/liuqian1/PLAprediction/software/PythonInstall"
make
make install

and then

MPYTHONHOME="/img01/home/liuqian1/PLAprediction/software/PythonInstall"
PATH="$MPYTHONHOME/bin":$PATH

However, when I try ' python -c "import binascii;" ', *I still got the same
error.*

By the way, I can run ' python -c "import binascii;" ' on Window XP and in
python 2.5.5.

Our technician also installed python 3.0 in our Linux server without the
'prefex' in the "./configure" but we got the same error also.

Any more comments about this?

Thanks for your help in advance.

Best regards,
Qian Liu

On Wed, Mar 7, 2012 at 5:12 PM, Qian Liu <report@bugs.python.org> wrote:

>
> Qian Liu <liuq0011@e.ntu.edu.sg> added the comment:
>
> Dear Martin,
>
> Many thanks for your help and your reply. I will correct the errors and let
> you know the result.
>
> best regards,
> Qian Liu
>
> On Wed, Mar 7, 2012 at 5:07 PM, Martin v. Löwis <report@bugs.python.org
> >wrote:
>
> >
> > Martin v. Löwis <martin@v.loewis.de> added the comment:
> >
> > There are some minor errors indeed: the syntax for PATH and PYTHONPATH is
> > wrong (don't use quotes (") in the middle of the value). Also, putting
> > site-packages into PYTHONPATH should not be necessary.
> >
> > I think the main cause might be the incorrect --prefix argument. Don't
> use
> > "~/PythonInstall", but "$HOME/PythonInstall". Also, when I try this, I
> get
> >
> > configure: error: expected an absolute directory name for --prefix:
> > ~/PythonInstall
> >
> > so you must have made something different (or you have used a shell
> > different from bash), else you would have gotten the same error.
> >
> > ----------
> >
> > _______________________________________
> > Python tracker <report@bugs.python.org>
> > <http://bugs.python.org/issue14216>
> > _______________________________________
> >
> >
>
> ----------
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <http://bugs.python.org/issue14216>
> _______________________________________
>
>
msg155126 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2012-03-07 22:15
I suggest you do two things:
- first, run “make -s” to reduce messages and see if the binascii module is compiled correctly or skipped
- second, avoid possible misleading issues with PATH entirely by starting your Python with an absolute path, like ~/path/to/python

(Sidenote: It would be kind of you to edit your replies to remove unneeded quotes from previous messages.  They just clobber the bug report.  Thanks in advance.)
msg155150 - (view) Author: Qian Liu (liuqianhn) Date: 2012-03-08 05:26
Hi, Eric Araujo,

Thanks for your help. I run "make -s" and found the following message. It
seems that binascii cannot be built correctly. What should I do? Many
thanks.

libpython2.7.a(posixmodule.o)(.text+0x47e1): In function `posix_tmpnam':
./Modules/posixmodule.c:7370: warning: the use of `tmpnam_r' is dangerous,
better use `mkstemp'
libpython2.7.a(posixmodule.o)(.text+0x46c7): In function `posix_tempnam':
./Modules/posixmodule.c:7317: warning: the use of `tempnam' is dangerous,
better use `mkstemp'
building dbm using gdbm
/usr/bin/ld: /usr/local/lib/libz.a(crc32.o): relocation R_X86_64_32 against
`a local symbol' can not be used when making a shared object; recompile
with -fPIC
/usr/local/lib/libz.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
/usr/bin/ld: /usr/local/lib/libz.a(crc32.o): relocation R_X86_64_32 against
`a local symbol' can not be used when making a shared object; recompile
with -fPIC
/usr/local/lib/libz.a: could not read symbols: Bad value
collect2: ld returned 1 exit status

Python build finished, but the necessary bits to build these modules were
not found:
_sqlite3           bsddb185           dl
imageop            sunaudiodev
To find the necessary bits, look in setup.py in detect_modules() for the
module's name.

*Failed to build these modules:*
*binascii           zlib*

Best regards,
Qian Liu
msg155155 - (view) Author: Ramchandra Apte (Ramchandra Apte) * Date: 2012-03-08 09:40
See http://www.gentoo.org/proj/en/base/amd64/howtos/index.xml?part=1&chap=3.
What it says might be the cause of the problem.
msg216191 - (view) Author: A.M. Kuchling (akuchling) * (Python committer) Date: 2014-04-14 19:57
No traffic on bug in 2 years, and not clear if there's anything to fix.  Closing.
History
Date User Action Args
2022-04-11 14:57:27adminsetgithub: 58424
2014-04-14 19:57:35akuchlingsetstatus: open -> closed

nosy: + akuchling
messages: + msg216191

resolution: not a bug
stage: resolved
2012-03-08 09:40:16Ramchandra Aptesetnosy: + Ramchandra Apte
messages: + msg155155
2012-03-08 05:26:41liuqianhnsetmessages: + msg155150
2012-03-07 22:15:49eric.araujosetnosy: + eric.araujo
messages: + msg155126
2012-03-07 09:35:21liuqianhnsetmessages: + msg155066
2012-03-07 09:12:41liuqianhnsetmessages: + msg155064
2012-03-07 09:06:59loewissetmessages: + msg155063
2012-03-07 08:48:29liuqianhnsetmessages: + msg155060
2012-03-07 08:23:02loewissetnosy: + loewis
messages: + msg155057
2012-03-07 07:47:17liuqianhncreate