apple / ccs-calendarserver

The Calendar and Contacts Server.
https://www.calendarserver.org
Apache License 2.0
485 stars 136 forks source link

Issue on running the server #468

Closed raminbp closed 7 years ago

raminbp commented 7 years ago

executing bin/run gives following:

python: posix_spawn: /my-path/ccs-calendarserver/.develop/virtualenv/bin/python2.72.7: No such file or directory

platform: Mac Osx El capitan

dreness commented 7 years ago

Hi @raminbp

Your error looks similar to what happens if pip is not installed. Until just a moment ago, the README was incorrect in its reference to using bin/install_pip, as we no longer ship such a script. I've updated README.rst to add the instruction to run "python -m ensurepip" to install pip, if you don't have it already.

Also, I feel like there might be issues with the keychain integration (specific to OS X). I haven't nailed it down yet, but it doesn't seem particularly happy right now on a couple different test machines. You can bypass the keychain integration by running: export USE_OPENSSL=1 prior to running ./bin/develop. If you have already run ./bin/develop, delete the .develop directory, then set USE_OPENSSL and run ./bin/develop again.

Update: the keychain weirdness is that if there are any mis-steps at all (such as, for example, attempting the bootstrapping over SSH, which prevents the GUI credential prompt from keychain, you have to purge as many of the following things from keychain as exist: the 'localhost' cert, the 'Imported Private Key', and the 'org.calendarserver.test' identity preference. THEN REBOOT before retrying, due to a securityd caching issue.

raminbp commented 7 years ago

Hi @dreness

I noticed the bin/install_pip doesn't exist but as far i saw in the logs , pip is installed during the first execution of bin/run. I also installed pip using the brew and the result was the same. i'll try your solution see if it resolves.

Thank you

raminbp commented 7 years ago

here is the last lines of running run/develop with use_openssl = 1

...

Installing collected packages: setuptools Successfully installed setuptools-23.1.0


Installing pip==8.1.2 Collecting pip==8.1.2 Using cached pip-8.1.2-py2.py3-none-any.whl Installing collected packages: pip Successfully installed pip-8.1.2


Installing virtualenv==15.0.2 Collecting virtualenv==15.0.2 Using cached virtualenv-15.0.2-py2.py3-none-any.whl Installing collected packages: virtualenv Successfully installed virtualenv-15.0.2 New python executable in /Users/raminbpr/Projects/Gam/darwin/ccs-calendarserver/.develop/virtualenv/bin/python2.7 Also creating executable in /Users/raminbpr/Projects/Gam/darwin/ccs-calendarserver/.develop/virtualenv/bin/python Installing pip, wheel...done. macOS virtualenv codesign fix. python: posix_spawn: /Users/raminbpr/Projects/Gam/darwin/ccs-calendarserver/.develop/virtualenv/bin/python2.72.7: No such file or directory

dreness commented 7 years ago

@raminbp Hrm, with a closer look at your original message I might have noticed that it's trying to access "python2.72.7", which is understandably not present.

I'd guess something about your setup violates the assumptions of CalendarServer's run / setup scripts. To get some debug information, try editing bin/_build.sh to add "set -x" right above the line '. "${wd}/bin/_py.sh";', then run ./bin/develop again. If you can share the output of that, hopefully I can figure out what's going on. The first part of the output should document how these scripts find a suitable python to use. On my system, the output is:

++ . /Users/andre/work/server/ccs-calendarserver/bin/_py.sh
+ develop
+ init_build
+ cd /Users/andre/work/server/ccs-calendarserver
+ init_py
++ detect_python_version
++ local v
++ local p
++ for v in '"2.7"' '""'
++ for p in '"${PYTHON:=}"' '"python${v}"'
+++ find_cmd ''
+++ local cmd=
+++ shift
++++ type ''
++++ sed 's|^ is \(a tracked alias for \)\{0,1\}||'
+++ local path=
+++ '[' -z '' ']'
+++ return 1
++ p=
++ for p in '"${PYTHON:=}"' '"python${v}"'
+++ find_cmd python2.7
+++ local cmd=python2.7
+++ shift
++++ type python2.7
++++ sed 's|^python2.7 is \(a tracked alias for \)\{0,1\}||'
+++ local path=/usr/bin/python2.7
+++ '[' -z /usr/bin/python2.7 ']'
+++ echo /usr/bin/python2.7
++ p=/usr/bin/python2.7
++ try_python /usr/bin/python2.7
++ local python=/usr/bin/python2.7
++ shift
++ '[' -z /usr/bin/python2.7 ']'
++ type /usr/bin/python2.7
+++ py_version /usr/bin/python2.7
+++ local python=/usr/bin/python2.7
+++ shift
++++ /usr/bin/python2.7 -c 'from distutils.sysconfig import get_python_version; print get_python_version()'
+++ echo 2.7
++ local py_version=2.7
+++ echo 2.7
+++ sed 's|\.||'
++ '[' 27 -lt 25 ']'
++ return 0
++ echo /usr/bin/python2.7
++ return 0
+ bootstrap_python=/usr/bin/python2.7
++ find_cmd /usr/bin/python2.7
++ local cmd=/usr/bin/python2.7
++ shift
+++ type /usr/bin/python2.7
+++ sed 's|^/usr/bin/python2.7 is \(a tracked alias for \)\{0,1\}||'
++ local path=/usr/bin/python2.7
++ '[' -z /usr/bin/python2.7 ']'
++ echo /usr/bin/python2.7
+ export PYTHON=/usr/bin/python2.7
+ PYTHON=/usr/bin/python2.7
raminbp commented 7 years ago
raminbp commented 7 years ago

it doesn't look like your output

dreness commented 7 years ago

Apparently this is somehow related to using python from homebrew. In a fresh VM, I installed dev tools, homebrew, ran "brew install python", and then git cloned the CS repo, which fails with the same error message you posted:

python: posix_spawn: /Users/local/ccs-calendarserver/.develop/virtualenv/bin/python2.72.7: No such file or directory

I'll investigate...

raminbp commented 7 years ago

thank you very much

dreness commented 7 years ago

@raminbp This seems to be caused by something we do during setup that's really only intended for the Server.app distribution of Calendar Server, related to code signing and other things that hopefully are of no interest to anyone reading this. We shouldn't be doing our 'codesign fix' for this, the open source distribution, and I will be confining that behavior to Server.app builds momentarily. In the mean time, if you comment out the 'cp' command shown below, that should fix it for you:

diff --git a/bin/_build.sh b/bin/_build.sh
index e3ec9b7..e6baed4 100644
--- a/bin/_build.sh
+++ b/bin/_build.sh
@@ -661,8 +661,8 @@ py_dependencies () {
       "${py_virtualenv}";
     case "$(uname -s)" in
       Darwin)
-        echo "macOS virtualenv codesign fix."
-        cp "/usr/bin/python" "${py_bindir}/python";
+        echo "skipping macOS virtualenv codesign fix."
+        #cp "/usr/bin/python" "${py_bindir}/python";
         ;;
     esac;
   fi;

... or you can just wait until I push a fix for this, which should be coming soon...

dreness commented 7 years ago

@raminbp This should be fixed as of https://github.com/apple/ccs-calendarserver/commit/935cf46edc39e17d163af796f9793c7600f6e837. You should delete the .develop directory before retrying, and you might even have to do the silly stuff I mentioned in the Update to this comment: https://github.com/apple/ccs-calendarserver/issues/468#issuecomment-253057362

raminbp commented 7 years ago

@dreness thank you very much, now its working

dreness commented 7 years ago

@raminbp you're welcome! glad to hear it's working. Perhaps I will add some automated tests that use other pythons... all our automated tests on OS X use apple's Python.