Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

youtube-dl cant run #1312

Closed
szunyi opened this issue Aug 25, 2013 · 10 comments
Closed

youtube-dl cant run #1312

szunyi opened this issue Aug 25, 2013 · 10 comments

Comments

@szunyi
Copy link

@szunyi szunyi commented Aug 25, 2013

hello

when i want to run the youtube-dl i got this error msg:

Traceback (most recent call last):
File "/usr/local/lib/python2.7/runpy.py", line 162, in _run_module_as_main
"main", fname, loader, pkg_name)
File "/usr/local/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "./youtube-dl/main.py", line 15, in
File "./youtube-dl/youtube_dl/init.py", line 48, in
File "./youtube-dl/youtube_dl/utils.py", line 21, in
File "/usr/local/lib/python2.7/urllib2.py", line 93, in
import hashlib
File "/usr/local/lib/python2.7/hashlib.py", line 136, in
globals()[__func_name] = __get_hash(__func_name)
File "/usr/local/lib/python2.7/hashlib.py", line 71, in __get_builtin_constructor
import _md5
ImportError: No module named _md5

@TOMBSTONEV2
Copy link

@TOMBSTONEV2 TOMBSTONEV2 commented Aug 25, 2013

This sounds like you don't have libssl-dev

Try sudo apt-get install libssl-dev then try to run. If that doesn't work remove python then re-install it after libssl-dev is installed.

@phihag
Copy link
Contributor

@phihag phihag commented Aug 25, 2013

Thank you for the report! Which platform are you seeing this problem on, i.e. can you provide steps to reproduce it? Can you import urllib2 in your locally installed Python?

@szunyi
Copy link
Author

@szunyi szunyi commented Aug 26, 2013

phihag:
CentOS release 5.9
Python 2.7 (r27:82500, Jul 14 2013, 11:18:46)
"Can you import urllib2 in your locally installed Python" -> i dont know how i can that :\

TOMBSTONEV2:
yes, reinstalled the "openssl-devel" (CentOS 5), but the error is still same :(
i dont want to remove python, because yum want to remove ~160 package :)

here is my installed python modules:
http://pastebin.com/vg21kCrG

@phihag
Copy link
Contributor

@phihag phihag commented Aug 26, 2013

@szunyi Thanks, that narrows it down, but a crucial piece of information is missing - how did you install Python? You're not using the system Python. To import urrlib2, start python and type

import urllib2
@szunyi
Copy link
Author

@szunyi szunyi commented Aug 26, 2013

Thanks for helping :)

"How did you install Python?" - As i remember, "yum install python" and "yum update"
"Start python and type...":

import urllib2
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python2.7/urllib2.py", line 93, in
import hashlib
File "/usr/local/lib/python2.7/hashlib.py", line 136, in
globals()[__func_name] = __get_hash(__func_name)
File "/usr/local/lib/python2.7/hashlib.py", line 71, in __get_builtin_constructor
import _md5
ImportError: No module named _md5

As i see i got multiple version installed of python:
[root@*** ~]# python
python python2.4 python3.3
python-config python2.7 python3.3m
python2 python2.7-config python3.3m-config

@phihag
Copy link
Contributor

@phihag phihag commented Aug 26, 2013

yum install python would install Python to /usr, but your libraries are installed to /usr/local. If you rename /usr/local/lib/python2.7 to, say, /usr/local/lib/python2.7__local, do you get the same error?

@szunyi
Copy link
Author

@szunyi szunyi commented Aug 26, 2013

I renamed the "/usr/local/lib/python2.7" to "/usr/local/lib/python2.7__local"

i got the following err msg:
[root@*** lib]# youtube-dl -U
Could not find platform independent libraries
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to [:<exec_prefix>]
ImportError: No module named site

@phihag
Copy link
Contributor

@phihag phihag commented Aug 26, 2013

That clarifies what's happening (you should move back the library now). You or someone else with admin rights has installed a customized version (probably self-compiled) of Python 2.7 on this machine, and set that up to be the default. However, during the time of compilation, libssl-dev was missing, and therefore the generated Python in non-functional.

What you can try is any of:

a) Use python3.3, like this:

python3.3 $(which youtube-dl)

To make this permanent, you can execute these commands, which set up a shell script that launches youtube-dl with python3.3:

YDL=$(which youtube-dl)
mv $YDL ${YDL}.pythonexe
/bin/echo -e '#!/bin/sh\nexec python3.3 '"${YDL}.pythonexe"' "$@"\n' > $YDL
chmod a+x $YDL

b) Fix your installation of Python 2.7

Recompiling it may be enough, so just run

./configure
make
make install

from the directory where Python2.7 has been compiled.


c) Set another Python version to be the default. This has likely effects on other applications as well and may therefore not be a good idea - contact your system administrator. Modify the symlink /usr/bin/python or /usr/local/bin/python to the Python of your choice.

@ocisly
Copy link
Contributor

@ocisly ocisly commented May 26, 2014

@phihag resolved?

@phihag
Copy link
Contributor

@phihag phihag commented Sep 13, 2014

Closing, one of these solutions should work. If it doesn't, please either comment or open a new issue. Thanks!

@phihag phihag closed this Sep 13, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.