Skip to content
This repository was archived by the owner on Oct 11, 2023. It is now read-only.

Fix install on cloudshell - #20

Merged
Sorra (SorraTheOrc) merged 14 commits into
Azure:masterfrom
SorraTheOrc:cloudshell
Aug 16, 2017
Merged

Sorra (SorraTheOrc) merged 14 commits into
Azure:masterfrom
SorraTheOrc:cloudshell

Conversation

@SorraTheOrc

Copy link
Copy Markdown
Contributor

Reinstate check for running in Docker container and don't use sudo if we are

Use virtualenv

Hopefully this addresses #19, but since my own cloudshell environment is set up correctly already it is hard to test. Would appreciate some testing on this PR

@msftclas

@rgardler,
Thanks for your contribution as a Microsoft full-time employee or intern. You do not need to sign a CLA.
Thanks,
Microsoft Pull Request Bot

@SorraTheOrc

Copy link
Copy Markdown
Contributor Author

This should fix #19

@alexandair

Copy link
Copy Markdown

@rgardler
This time it fails to create a symlink:
ln: failed to create symbolic link '/home/aleksandar/bin/../simdem/main.py': File exists

How can I remove all traces of simdem and try new installation?

aleksandar@Azure:~$ git clone -b cloudshell https://github.com/rgardler/simdem.git
Cloning into 'simdem'...
remote: Counting objects: 1912, done.
remote: Compressing objects: 100% (195/195), done.
remote: Total 1912 (delta 238), reused 334 (delta 178), pack-reused 1511
Receiving objects: 100% (1912/1912), 290.68 KiB | 0 bytes/s, done.
Resolving deltas: 100% (1131/1131), done.
Checking connectivity... done.
aleksandar@Azure:~$ cd simdem
aleksandar@Azure:~/simdem$ ./scripts/install.sh
Running in a Docker container
W: chmod 0700 of directory /var/lib/apt/lists/partial failed - SetupAPTPartialDirectory (1: Operation not permitted)
E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)
E: Unable to lock directory /var/lib/apt/lists/
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
Using base prefix '/usr'
New python executable in /home/aleksandar/simdem/simdem-env/bin/python3
Also creating executable in /home/aleksandar/simdem/simdem-env/bin/python
Installing setuptools, pip, wheel...done.
Collecting colorama (from -r requirements.txt (line 1))
  Downloading colorama-0.3.9-py2.py3-none-any.whl
Collecting flask (from -r requirements.txt (line 2))
  Using cached Flask-0.12.2-py2.py3-none-any.whl
Collecting flask-socketio (from -r requirements.txt (line 3))
Collecting pexpect (from -r requirements.txt (line 4))
  Downloading pexpect-4.2.1-py2.py3-none-any.whl (55kB)
    100% |████████████████████████████████| 61kB 4.1MB/s
Collecting Werkzeug>=0.7 (from flask->-r requirements.txt (line 2))
  Using cached Werkzeug-0.12.2-py2.py3-none-any.whl
Collecting itsdangerous>=0.21 (from flask->-r requirements.txt (line 2))
Collecting click>=2.0 (from flask->-r requirements.txt (line 2))
  Using cached click-6.7-py2.py3-none-any.whl
Collecting Jinja2>=2.4 (from flask->-r requirements.txt (line 2))
  Downloading Jinja2-2.9.6-py2.py3-none-any.whl (340kB)
    100% |████████████████████████████████| 348kB 5.2MB/s
Collecting python-engineio>=1.0.0 (from flask-socketio->-r requirements.txt (line 3))
Collecting python-socketio>=1.5.0 (from flask-socketio->-r requirements.txt (line 3))
Collecting ptyprocess>=0.5 (from pexpect->-r requirements.txt (line 4))
  Downloading ptyprocess-0.5.2-py2.py3-none-any.whl
Collecting MarkupSafe>=0.23 (from Jinja2>=2.4->flask->-r requirements.txt (line 2))
  Downloading MarkupSafe-1.0.tar.gz
Collecting six>=1.9.0 (from python-engineio>=1.0.0->flask-socketio->-r requirements.txt (line 3))
  Downloading six-1.10.0-py2.py3-none-any.whl
Building wheels for collected packages: MarkupSafe
  Running setup.py bdist_wheel for MarkupSafe ... done
  Stored in directory: /home/aleksandar/.cache/pip/wheels/88/a7/30/e39a54a87bcbe25308fa3ca64e8ddc75d9b3e5afa21ee32d57
Successfully built MarkupSafe
Installing collected packages: colorama, Werkzeug, itsdangerous, click, MarkupSafe, Jinja2, flask, six, python-engineio, python-socketio, flask-socketio, ptyprocess, pexpect
Successfully installed Jinja2-2.9.6 MarkupSafe-1.0 Werkzeug-0.12.2 click-6.7 colorama-0.3.9 flask-0.12.2 flask-socketio-2.9.2 itsdangerous-0.24 pexpect-4.2.1 ptyprocess-0.5.2 python-engineio-1.7.0 python-socketio-1.8.0 six-1.10.0
ln: failed to create symbolic link '/home/aleksandar/bin/../simdem/main.py': File exists

@alexandair

Copy link
Copy Markdown

If I run main.py directly, I get this:

aleksandar@Azure:~/bin$ ./main.py
Traceback (most recent call last):
  File "./main.py", line 12, in <module>
    from web import WebUi
  File "/home/aleksandar/bin/web.py", line 1, in <module>
    from flask import Flask, send_from_directory
ImportError: No module named 'flask'

@SorraTheOrc

Copy link
Copy Markdown
Contributor Author

Thanks for testing.

Can you try again, I think I resolved the failed symlink issue now.

Note, the new install script creates a Python Virtual environment, this needs to be activated before you can run Simdem. I've updated the readme to reflect this but the short version is to run source simdem-env/bin/activate from within the simdem code directory.

@alexandair

Copy link
Copy Markdown

I don't know what I'm doing wrong:

aleksandar@Azure:~$ cd simdem
aleksandar@Azure:~/simdem$ dir
cli.py     demo.py       Dockerfile_cli    environment.py  env.local.json      js       main.py  pre-commit.sh  requirements.txt  simdem-env  templates
config.py  demo_scripts  Dockerfile_novnc  env.json        GETTING_STARTED.md  LICENSE  novnc    README.md      scripts           style       web.py
aleksandar@Azure:~/simdem$ source simdem-env/bin/activate
(simdem-env) aleksandar@Azure:~/simdem$ simdem --version
bash: simdem: command not found

@SorraTheOrc

Copy link
Copy Markdown
Contributor Author

It doesn't look like you are doing anything wrong, it's just that you are the first person I know of trying this install in cloudshell step. You're finding the bugs (I probably did some manual step I forgot about).

Now you are doing the virtualenv you should be able to run using ./main.py --version

Simdem should have been installed into ~/bin/simdem-dev and there should be a symlink to is at ~/bin/simdem

You should also have ~/bin in your $PATH

Can you please see which one of those conditions is not satisfied (my guess would be the last one)

@alexandair

Copy link
Copy Markdown

./main.py --version returns "Permission denied."

$PATH inside of a virtualenv is:
(simdem-env) aleksandar@Azure:~/simdem$ echo $PATH /home/aleksandar/simdem/simdem-env/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/go/bin:/opt/mssql-tools/bin

@SorraTheOrc

Copy link
Copy Markdown
Contributor Author

Looks like your path is not setup as needed. Please run PATH=$PATH:~/bin and then try simdem --version

If this works I'll update this PR to make this setting permanent.

(Thanks for persevering with me on this)

@alexandair

Copy link
Copy Markdown

after modifying $PATH and starting a virtualenv, it finally works:

(simdem-env) aleksandar@Azure:~/simdem$ simdem --version
0.8.0-dev

@alexandair

Copy link
Copy Markdown

I've created a directory simdemos and one .md file with a couple of commands and try to run it with:
$ simdem demo -p ~/clouddrive/simdemos

What happens is that command clear is typed, screen is cleared, and I'm at prompt.

@SorraTheOrc

Copy link
Copy Markdown
Contributor Author

Yay for getting you up and running - and thanks for your patience. I'll update this PR to make that permanent and merge it soon.

Regarding your second comment, that's expected as you are running in "demo" mode. Hit a key and it should "type" the first command in your .md file. See https://github.com/Azure/simdem#demo-mode

If you want to see descriptive text and instructions run in "tutorial" mode by replacing "demo" with tutorial.

Other modes are available, see the readme linked above.

@alexandair

Copy link
Copy Markdown

Those instructions are for running commands in a container and I get an error that docker deamon is not started.
What is the right command in Cloud Shell to start a demo (or tutorial) if I have a README.md file with a couple of commands in the ~/clouddrive/simdemos directory?

@SorraTheOrc

Sorra (SorraTheOrc) commented Aug 15, 2017 via email

Copy link
Copy Markdown
Contributor Author

@alexandair

Copy link
Copy Markdown

I'm making some progress. :) Commands in my README.md weren't correctly written. I've used an inline single backticks instead of three backticks in new lines.

Now I have a new issue. My echo command works as expected, but simdem bumps on executing Azure CLI command:

$ $ echo "hello world"
hello world

$ az vm list -d -o table
/home/aleksandar/simdem/simdem-env/bin/python: Error while finding spec for 'azure.cli' (ImportError: No module named 'azure')

@SorraTheOrc

Copy link
Copy Markdown
Contributor Author

Can you open up a new issue for this. Can you test that the command you want to run works outside of SimDem.

@alexandair

Copy link
Copy Markdown

Yes, a command works outside of simdem. I'll open a new issue.

@SorraTheOrc
Sorra (SorraTheOrc) merged commit a16597a into Azure:master Aug 16, 2017
Sorra (SorraTheOrc) added a commit to SorraTheOrc/simdem that referenced this pull request Aug 16, 2017
…version that works in CloudShell and updated install instructions. This is a temporary measure to unblock users in CloudShell.
Tommy Falgout (lastcoolnameleft) pushed a commit that referenced this pull request Dec 20, 2017
need to include the LICENSE file, otherwise pypi installs are broken …
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants