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

Python won't run on Synology #376

Closed
Pokersut opened this issue Jan 9, 2013 · 50 comments
Closed

Python won't run on Synology #376

Pokersut opened this issue Jan 9, 2013 · 50 comments

Comments

@Pokersut
Copy link

Pokersut commented Jan 9, 2013

On my DS-413 with DSM 4.2-3160, I cannot run the Python package from SynoCommunity.

It seems to install successfully, but when I try to install other packages that require Python (e.g. Sickbeard), I get the message "Please run Python before installing this package".

Since there is no "Run" command for the Python package, I don't know what to do. I have tried installing Synology's own Python package (v. 2.7.3-011), and it installs and runs without problems - but Sickbeard will not install under with version.

I had the same problem last time I upgraded the firmware, but then I could fix the problem by uninstalling, rebooting and re-installing Python - but this hasn't worked this time.

Any ideas?

@Diaoul
Copy link
Member

Diaoul commented Jan 9, 2013

Edit /var/packages/python/scripts/start-stop-status and change this line to exit 0

@Pokersut
Copy link
Author

Pokersut commented Jan 9, 2013

Thanks - I'll give it a try. I currently have Synology's Python package installed, and it's in use by a backup job, so I'll have to wait until it's finished.

Will post back if I still have problems.

@zim514
Copy link

zim514 commented Jan 9, 2013

I had the same issue with the 4.2 beta and this change fixed the problem. Thanks!

@Omertron
Copy link

Omertron commented Jan 9, 2013

Confirmed that this solved the issue for me too!
Thanks

@gendi
Copy link

gendi commented Jan 10, 2013

Worked here too

@rajek
Copy link

rajek commented Jan 11, 2013

Had the same problem on DS213+ DSM 4.2-3160 BETA
Diaoul's fix solved problem.

@Diaoul
Copy link
Member

Diaoul commented Jan 11, 2013

Can someone report this to Synology?

@Dr-Bean
Copy link
Contributor

Dr-Bean commented Jan 11, 2013

@Diaoul Maybe you've already noticed, but Synology is actually using the same approach in their own non-startable packages, e.g. the new Java and Perl packages, so it seems to be correct.
Perl for example does this:

status)
        if [ -e "/usr/bin/perl" ]; then
            exit 0
        else
            exit 150
        fi

@Diaoul
Copy link
Member

Diaoul commented Jan 11, 2013

Yes, but our Python SPK doesn't "run" that's nonsense.

@Dr-Bean
Copy link
Contributor

Dr-Bean commented Jan 11, 2013

Perl doesn't either...I been looking around a bit to see what the idea was, seems exit 0 is succes based on file existance and/or running service (not all packages have been updated, I guess). 0 happens to show as 'Running' in the package center. Exit 1 is 'Stopped' (and blocks dependant packages as a result), exit 150 is 'Broken'.

Entered a request ID: #1142, let's see.

@diehardmking
Copy link

YES is works!!! (exit 0) now i can installl SasNZB and sickbeard!! thanks a million!

@dwhite456
Copy link

hi. I am having the same issue. Noob Q. I telnet into synology box. I use vi to edit the file. I think I am in read only mode for the file as I make changes and I am unable to save. How can I change properties on file from read only to write? I logged in as admin. Thanks

@diehardmking
Copy link

You have to be logged in as Root (same pass as admin). In vinyou have to save the file using :wq after this check the file again.

@dwhite456
Copy link

Diehrdmking- Thanks for your reply, that did the job. Much appreciated.

@Dr-Bean
Copy link
Contributor

Dr-Bean commented Jan 18, 2013

Received a response to my request:
We are aware of this issue, and we are currently working on a fix for it. We assure this issue will be fixed by the time the final version of the firmware is released. This should be within several weeks.

So that's good. I did some suggestions when I put in the request, but no details on on what kind of fix is being developed: I'll be interested to see it.

@yoper
Copy link

yoper commented Jan 23, 2013

Hi, Noob question. How do I do these steps to get sabnzbd working on my NAS? I've tried to find the way, but I simple don't find the package to be able to edit. I have installed the Python from synocommunity.

Thank you!

@diehardmking
Copy link

Hello,

What you also can try is work with a lower version of sasnzb bij using http://synopkg.superzebulon.org/spkrepo/packages
As an package link. This has his own sasnzb and python. ( first uninstall your current packages of phyton and sasnzb)

@yoper
Copy link

yoper commented Jan 24, 2013

thanks for your reply dieharddmking, but these older versions of sabnzbd will run on my NAS? because i forgot to tell that I have installed the last beta version of DSM (4.2-3160). Can you point me some webpage that I can read to understand how to do this kind of things?

thank you!

@fixmynas
Copy link

Sorry for the Noob question, but how do I
Edit /var/packages/python/scripts/start-stop-status and change this line to exit 0

@Omertron
Copy link

log into your NAS using ssh and something like "putty" (google it)
vi /var/packages/python/scripts/start-stop-status
press i
press #
press "ESC"
press : then w then q then "ENTER"

@fixmynas
Copy link

ok so logged into NAS via Putty, as user "root" edit the file, changes stop 1 to "stop 0", but now don't know how to save and exit the file ???

I press :wq and that's what is typed on the screen . sorry I've never edited files in Putty. Where must the cursor be to type ":wq" ? help

@Omertron
Copy link

You need to press "ESC" to get out of editing mode
then just ":wq" "ENTER"

@Pokersut
Copy link
Author

If you are not familiar with Putty (I'm not!), I suggest you install the programme WinSCP (google it) instead.

This gives you an explorer view of the file structure on the NAS and you can right-click on files to edit them in your favourite text-editor (I use Notepad++).

Once you have edited the file, you just save the changes, and WinSCP will automatically transfer the edited file to the NAS.

@fixmynas
Copy link

@Omerton: "You need to press to get out of editing mode". Press ? It took me a while to figure out that I needed to press "Escape" to get out of Insert Mode. I noticed the "I" in the last row changed once I pressed "ESC" the ":wq" and "enter". Sorry this was the first time I'd used Putty.

@Pokersut - next time I'll use WinSCP

Saved the file went back and to my Python package and its running. ALL GOOD - THANKS GUYS

@Omertron
Copy link

@fixmynas Sorry, seems the < and > were replaced. Press the Escape key

@yoper
Copy link

yoper commented Jan 28, 2013

@Omertron Thank you! Now everything is working. :)

@Pokersut - Great tip this WinSCP it turns everything easier! :) I did it with this! Thank you!

@liorreem
Copy link

Hi
I have the same issue. tried to connect with WinSCP but I don't have such path on my NAS (413j) root:
/var/packages/python/scripts/
Why?
Thanks.

@Careless
Copy link

Careless commented Feb 9, 2013

DS712+ with DSM 4.2-3161.
Sabnzbd and all other packages updated to most recent.

This still isn't working for me.

  • I have tried the change using vi through ssh/telnet shown earlier in this discussion.
  • I have tried rebooting.
  • I have tried shutting down and restarting.
  • I have tried uninstalling and reinstalling the packages and making any changes described, again.

The error seems to persist.

I noticed after editing in "vi", and doing the whole ":wq" step, it says "file is read only". but the file still seems to be changed?

Screen Shot 2013-02-09 at 6 40 43 AM

Screen Shot 2013-02-09 at 6 41 27 AM

Anyone got any ideas?

@Dr-Bean
Copy link
Contributor

Dr-Bean commented Feb 9, 2013

@Careless You have an additional issue: #373

@Careless
Copy link

Careless commented Feb 9, 2013

Thanks Dr-Bean,

I saw that one too, that's how I was lead here. But I was under the impression that performing this fix would not require the other script to be stopped (for whatever it's used for, I'm not sure... that's why I wanted to leave it alone).

I'll try that now, and report back.

UPDATE: Ok.. So why can't I write to these files? I'm using the administrator account (system default user) for the editing in VIM and it's saying "read only"... is there something I'm missing? I am using OSX Terminal to complete these tasks.

UPDATE 2: Nnnnnnevermind! I used root/admin to telnet into the box instead of my System default user- which I had thought I did the first time around. But I must have used root/admin that time as well (did it a week ago, was still having this issue)... Thanks!

UPDATE 3: wooooooooo! it worked. should have done that one earlier. Thanks Dr-Bean. 👍 💯

@bjbe70
Copy link

bjbe70 commented Mar 6, 2013

Hi,

I have the same problem with the released version of DSM 4.2.
But when I change the /var/packages/python/scripts/start-stop-status ("exit 1" to "exit 0") the paket center reports an error and says that I have to "repair" the installation of python. And I press "repair" and wait for the new installation of python I get again the same issue with the installation of SABNZBD. Do I do something wrong?

Thank you for advice!

@ghost
Copy link

ghost commented Mar 6, 2013

Thanks, this worked!

@ghost
Copy link

ghost commented Mar 6, 2013

@bjbe70 Are you sure you only changed line 19?

@bjbe70
Copy link

bjbe70 commented Mar 6, 2013

Hi krvermeulen,

yes I am. Tried it several times. I used the python 2.7.3-4 version from SynoCommunity. Is that correct? Or do I have to install the version 2.7.3-011 from Synology?

This is my start-stop-status:

#!/bin/sh

Package

PACKAGE="python"
DNAME="Python"

Others

INSTALL_DIR="/usr/local/${PACKAGE}"

case $1 in
start)
exit 0
;;
stop)
exit 0
;;
status)
exit 0
;;
log)
echo "${INSTALL_DIR}/install.log"
exit 0
;;
*)
exit 1
;;
esac
Python

@banditdk
Copy link

banditdk commented Mar 6, 2013

I had the same problem on my DS212 with DSM 4.2-3202 & python 2.7 from SynoCommunit, and the edit to "exit 0" fixed the problem on mine.
No faults displayed:

image

@Diaoul
Copy link
Member

Diaoul commented Mar 6, 2013

Will fix this today as DSM 4.2 final didn't solve it...

@bjbe70
Copy link

bjbe70 commented Mar 6, 2013

I also have DSM 4.2-3202.
Did you do a reboot or something?
When you updated to DSM 4.2, did you also have to reinstall all the packages?

@bjbe70
Copy link

bjbe70 commented Mar 6, 2013

I edited the "/var/packages/python/scripts/start-stop-status" with WinSCP-Editor and saved it with it remote. Is that a problem? Or do i need to use the vi?

@bjbe70
Copy link

bjbe70 commented Mar 6, 2013

That sounds good, Diaoul! Thank you for your support!

@Pokersut
Copy link
Author

Pokersut commented Mar 6, 2013

I used WinSCP to edit mine, and it worked fine. I did uninstall/reinstall all the packages, though, but I'm not sure that was necessary - but it worked!

@Pokersut Pokersut closed this as completed Mar 6, 2013
@Pokersut Pokersut reopened this Mar 6, 2013
@bjbe70
Copy link

bjbe70 commented Mar 6, 2013

Pokersut, you uninstalled all the packages manually after update to DMS 4.2-3202?
When I updated all the packages were lost! I had to reinstall them manually.

@Pokersut
Copy link
Author

Pokersut commented Mar 6, 2013

When I updated to 3202, all the packages remained, but SabNZB wouldn't
start. At that point I decided to uninstall all packages and try from
scratch, but that was mostly because I had forgotten all about this
thread!

Anyway, I reinstalled the Python package, edited the start-stop file
and after that SabNZB installed and ran without problems - except, of
course, that all my settings had gone...

bjbe70 skrev den 2013-03-06 13:40:

Pokersut, you uninstalled all the packages manually after update to
DMS 4.2-3202?
When I updated all the packages were lost! I had to reinstall them
manually.

Reply to this email directly or view it on GitHub [1].

Links:

[1]
#376 (comment)

@bjbe70
Copy link

bjbe70 commented Mar 6, 2013

Hi,
now it works also for me!!

Reason: I used the internal editor of WinSCP instead of an external. The internal editor converted all "LF" to "LF+CR" ...

@Diaoul
Copy link
Member

Diaoul commented Mar 12, 2013

That's fixed with 7cc7015

@Diaoul Diaoul closed this as completed Mar 12, 2013
@randomspam
Copy link

Sorry to raise this again, I am hoping someone can help as I have got pretty far using the insutrctions above but I am struggling myself with the error when trying to install Sickbeard, Couch Potato Server and SABnzbd on a Synology DS212J running DSM 4.2-3202

When I try and install any of them I get the following error

please install python 2.7.3-3 before installing this package

Obviously it's already installed and I've used the Synology package version 2.7.3-011 . So using the instructions here I have installed WinSCP, Enabled the SFTP service, switched on SSH in my NAS and then navigated through to

/var/packages/python/scripts/start-stop-status

but when I get there my file looks different in notepad to everyone elses, I have an else statement of somekind and despite changing the second exit option within status to 0 it still doesn't fix the problem. Any ideas from anyone?

#!/bin/sh

PYTHON_VER="python2.7"

SOURCE_LIB=$SYNOPKG_PKGDEST"/usr/local/lib/"$PYTHON_VER
SOURCE_INC=$SYNOPKG_PKGDEST"/usr/local/include/"$PYTHON_VER
SOURCE_BIN=$SYNOPKG_PKGDEST"/usr/local/bin"

TARGET_LIB="/usr/local/lib/"$PYTHON_VER
TARGET_INC="/usr/local/include/"$PYTHON_VER
TARGET_BIN="/usr/local/bin"

COPY_TO_USR()
{
    if [ ! -d "$TARGET_LIB" ]; then
        mkdir -p $TARGET_LIB
        cp -af $SOURCE_LIB/* $TARGET_LIB
    fi
    if [ ! -d "$TARGET_INC" ]; then
        mkdir -p $TARGET_INC
        cp -af $SOURCE_INC/* $TARGET_INC
    fi
    if [ ! -e "$TARGET_BIN/$PYTHON_VER" ]; then
        mkdir -p $TARGET_BIN
        cp -af $SOURCE_BIN/python* $TARGET_BIN
    fi
    if [ ! -L "$TARGET_LIB/site-packages" ]; then
        rm -rf $TARGET_LIB/site-packages
        ln -s  $SOURCE_LIB/site-packages $TARGET_LIB/site-packages
    fi
}

COPY_LIBS()
{
    local PYTHON_EXTRA_LIBS="$SYNOPKG_PKGDEST/exlibs"

    # check and copy readline, also create link for it
    if [ ! -e "/lib/libreadline.so.6.2" ]; then
        cp -f $PYTHON_EXTRA_LIBS/libreadline.so.6.2 /lib
        ln -s /lib/libreadline.so.6.2 /lib/libreadline.so.6
    fi

    # check and copy libxslt
    if [ ! -e "/lib/libxslt.so" ]; then
        cp -af $PYTHON_EXTRA_LIBS/libxslt.so* /lib
    fi

    if [ ! -e "/lib/libexslt.so" ]; then
        cp -af $PYTHON_EXTRA_LIBS/libexslt.so* /lib
    fi
}

case $1 in
    start)
        COPY_TO_USR
        COPY_LIBS
        ln -s $TARGET_BIN/$PYTHON_VER /usr/bin/python
        exit 0
    ;;
    stop)
        exit 0
    ;;
    status)
        if [ -e "${TARGET_BIN}/python" ]; then
            exit 0
        else
            exit 1
        fi
    ;;
    killall)
        ;;
    log)
        exit 0
    ;;
esac

@Diaoul
Copy link
Member

Diaoul commented Apr 2, 2013

Use SynoCommunity's Python SPK, not Synology's.

@randomspam
Copy link

Wow, that simple huh!? Works fine now, thanks Diaoul 👍

@Tobile
Copy link

Tobile commented Sep 13, 2014

Hey guys,

somehow i don't seem to be able to make it.
i've installed the python comunity package on my synology 114 (dsm 5). It shows as correctly installed.
i've also installed WinSCP, as someone suggested, but when I run it, all i see is the folder structure I'm already seeing on the NAS itself: my personal data on the NAS and no files from the packages i installed. when i'm searching for "scripts" or "start-stop-status" it won't find anything

what am I doing wrong?? any suggestions?
thank you!
tobi

@cognopatrick
Copy link

hey guys,

Ik have succesfully installed python in my synology nas but i can't find how to add libraries for python. can anyone help me?

@Diaoul
Copy link
Member

Diaoul commented Jan 3, 2016

@cognopatrick: Use virtualenv to create yourself an isolated environment to work with. On your NAS, virtualenv is located at /usr/local/python/bin/virtualenv.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests