Coder-Spirit / Jupyter-PHP-Installer

An installer for Jupyter-PHP
MIT License
44 stars 20 forks source link

Error while trying to download Jupyter-PHP dependencies when PATH includes a space #20

Open tdmalone opened 6 years ago

tdmalone commented 6 years ago

Hi there!

Brand new to Jupyter, and thought I'd give this a crack. I'm having trouble with the installation though.. I was wondering if you could help shed some light and/or advise on the best debugging steps?

I'm on MacOS 10.31.6.

$ php ./jupyter-php-installer.phar install
sh: Studio: command not found
sh: Studio: command not found
sh: Studio: command not found
ERROR: Error while trying to download Jupyter-PHP dependencies with Composer.

$ php ./jupyter-php-installer.phar install -vvv
sh: Studio: command not found
sh: Studio: command not found

sh: Studio: command not found

ERROR: Error while trying to download Jupyter-PHP dependencies with Composer.

Some versions...

$ php ./jupyter-php-installer.phar --version
Jupyter-PHP Installer 0.2

$ bash --version
GNU bash, version 4.4.23(1)-release (x86_64-apple-darwin17.5.0)

$ php --version
PHP 7.2.8 (cli) (built: Jul 19 2018 12:15:24) ( NTS )

$ composer --version
Composer version 1.6.5 2018-05-04 11:44:59

$ jupyter --version
4.4.0

$ php -i | grep -i zmq
zmq
ZMQ extension => enabled
ZMQ extension version => 1.1.3
libzmq version => 4.2.5
castarco commented 6 years ago

Hmm... this could be a bug... has MacOs the command command? ( I'm not joking :sweat_smile: )

castarco commented 6 years ago

I think the bug could be here: https://github.com/Litipk/Jupyter-PHP-Installer/blob/master/src/System/UnixSystem.php#L46 , but I don't have a Mac, so I can't really test it.

tdmalone commented 6 years ago

command should be all good... the syntax highlighting in my original post was probably a little confusing 😛

$ command -v composer && echo $?
/usr/local/bin/composer
0
$ command -v whoami && echo $?
/usr/bin/whoami
0

Studio isn't a valid command though - but I can't see where this is being called...

tdmalone commented 6 years ago

Ok, I found the problem. Studio comes from my PATH, which includes the path /Applications/Visual Studio Code.app/Contents/Resources/app/bin.

Because Jupyter-PHP-Installer is printing out the contents of the PATH variable before the composer init & install commands, the shell is expecting PATH to end at - in my case - '.../Visual', and then is trying to run 'Studio' as a command.

I adjusted my PATH to remove this path, and the installer succeeded.

I think the fix is probably to output quotes around the value of getenv('PATH') in https://github.com/Litipk/Jupyter-PHP-Installer/blob/master/src/Installer/Installer.php#L129.

brehar commented 5 years ago

Figuring this out gave me quite the headache, I've got to tell you. It took me a while just to finally stumble upon someone having this problem recently (and with everything properly installed).

But easy fix: Just set your path for the session (which will not be permanent), and run the .phar installer. Easy once I knew what the bug was ;)

thestud commented 4 years ago

Set your path to what to fix it?

gohada commented 4 years ago

sudo nano /etc/paths

ikingye commented 3 years ago

Set your path to what to fix it?

echo $PATH

find The blank space and remove them.

For example, the path is "/x/bin:/y/bin:/z/foo bar/bin", you can set the path temporary by export path="/x/bin:/y/bin" (just remove the blank space one).

Then you run php jupyter-php-installer.phar install -n -vvv