Python Forum
Advice for installing python app from github ?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Advice for installing python app from github ?
#1
Good Evening,

I am just starting out with python (3.11) and i wanted to download an app from github ( a python photo album ). The author has kindly made some instructions, but i am totally lost already !!
in the windows (10) command line i tyype "py" and python 3.11.1 starts with the black screen, then i tried the instructions:-

1.Create venv virtual environment:
virtualenv virtualenv_name

i typed this into the python command line and received :-
>>> virtualenv virtualenv_name
File "<stdin>", line 1
virtualenv virtualenv_name
^^^^^^^^^^^^^^^
SyntaxError: invalid syntax

2. Activate venv virtual environment:
On Linux - source virtualenv_name/bin/activate
On Windows - virtualenv_name/Scripts/activate

does this windows command go into the command line as well ?

3.Firstly you need to clone or download my project from github repositories:
git clone https://github.com/hossainchisty/Photo-Album-App.git

i got this to work, it has been saved into "C:\Users\Adrian\Documents\GitHub\Photo-Album-App"

4. Then enter the corresponding directory:
cd Photo-Album-App

i substituted this for the path that the album has been installed in and received :-

C:\Users\Adrian\Documents\GitHub\Photo-Album-Appcd
^
SyntaxError: unexpected character after line continuation character

i am not sure where any of the following should be typed :-

Install all the requirements using pip:
pip install -r requirements.txt

Run server:
python manage.py runserver

Then go to http://127.0.0.1:8000 in your browser
Create Admin
python manage.py createsuperuser

Access the admin dashboard http://127.0.0.1:8000/admin

the github page is https://github.com/hossainchisty/Photo-Album-App#readme

any advice would be much appreciated !!!

Best Regards

Adrian
Reply
#2
You don't create a virtual environment inside python, you create the environment from a shell (windows CMD or powershell).

Once you create the virtual environment you should have no difficulty activating the environment.

These should also be typed in a shell (windows CMD or powershell).

virtualenv_name/Scripts/activate
pip install -r requirements.txt
Reply
#3
You are making some error here.
(Aug-07-2023, 04:47 PM)Adi44 Wrote: the windows (10) command line i tyype "py" and python 3.11.1 starts with the black screen, then i tried the instructions:-
Don't start Python interactive interpreter,shall use command from command cmd.
Also no need to use virtualenv,as Python now has build in with venv.
You need Git installed to clone the Repo

Quick run demo,i use cmder but commands is the same for cmd.
So it work when i open in browser see album images.
# Make environment 
G:\div_code
λ python -m venv photo_env

# Cd in
G:\div_code
λ cd photo_env\

# Activate 
G:\div_code\photo_env
λ G:\div_code\photo_env\Scripts\activate.bat

# Clone repo down
(photo_env) G:\div_code\photo_env
λ git clone https://github.com/hossainchisty/Photo-Album-App.git
Cloning into 'Photo-Album-App'...
remote: Enumerating objects: 291, done.
remote: Counting objects: 100% (38/38), done.
remote: Compressing objects: 100% (16/16), done.
remote: Total 291 (delta 29), reused 22 (delta 22), pack-reused 253
Receiving objects: 100% (291/291), 16.39 MiB | 2.92 MiB/s, done.
Resolving deltas: 100% (121/121), done.

# Cd in
(photo_env) G:\div_code\photo_env
λ cd Photo-Album-App\

# Install
(photo_env) G:\div_code\photo_env\Photo-Album-App (master)
λ pip install -r requirements.txt
Collecting crispy-tailwind==0.4.0
  Downloading crispy_tailwind-0.4.0-py3-none-any.whl (38 kB)
Collecting asgiref==3.3.4
  Downloading asgiref-3.3.4-py3-none-any.whl (22 kB)
Collecting Django==3.2.2
  Downloading Django-3.2.2-py3-none-any.whl (7.9 MB)
     ---------------------------------------- 7.9/7.9 MB 5.9 MB/s eta 0:00:00
Collecting Pillow==9.3.0
  Downloading Pillow-9.3.0-cp311-cp311-win_amd64.whl (2.5 MB)
     ---------------------------------------- 2.5/2.5 MB 8.3 MB/s eta 0:00:00
Collecting pytz==2021.1
  Using cached pytz-2021.1-py2.py3-none-any.whl (510 kB)
Collecting sqlparse==0.4.1
  Using cached sqlparse-0.4.1-py3-none-any.whl (42 kB)
Collecting django-crispy-forms>=1.11.2
  Downloading django_crispy_forms-2.0-py3-none-any.whl (31 kB)
Installing collected packages: pytz, sqlparse, Pillow, asgiref, Django, django-crispy-forms, crispy-tailwind
Successfully installed Django-3.2.2 Pillow-9.3.0 asgiref-3.3.4 crispy-tailwind-0.4.0 django-crispy-forms-2.0 pytz-2021.1 sqlparse-0.4.1

# Look at dir and files, use <dir in> cmd
(photo_env) G:\div_code\photo_env\Photo-Album-App (master)
λ ls
Album/  Project/  README.md  accounts/  db.sqlite3  demo/  manage.py*  media/  requirements.txt  static/

# Test run
(photo_env) G:\div_code\photo_env\Photo-Album-App (master)
λ python manage.py runserver
Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).
August 07, 2023 - 19:20:57
Django version 3.2.2, using settings 'Project.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
[07/Aug/2023 19:21:11] "GET / HTTP/1.1" 302 0

# Make super user
(photo_env) G:\div_code\photo_env\Photo-Album-App (master)
λ python manage.py createsuperuser
Username (leave blank to use 'tom'):
....

# Test app
(photo_env) G:\div_code\photo_env\Photo-Album-App (master)
λ python manage.py runserver
Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).
August 07, 2023 - 19:23:20
Django version 3.2.2, using settings 'Project.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
[07/Aug/2023 19:23:30] "GET / HTTP/1.1" 302 0
[07/Aug/2023 19:23:30] "GET /accounts/sign-in/?next=/ HTTP/1.1" 200 3029
....
Reply
#4
Many Thanks for the replies

I am still confused about ow to create a virtual environment, i open the CMD window as suggested, and do not type "py" ?

i tried, just opening the window and typing "virtualenv virtualenv_name", that just generated an error, also as snippsat said i tried "cmd virtualenv virtualenv_name", then again generated an error.

Am i using the correct syntax ?, as snippsat said just use "venv" ?

when i use powershell and type "virtualenv virtualenv_name", the following occurs :-

PS C:\Users\Adrian> virtualenv virtualenv_name
virtualenv : The term 'virtualenv' is not recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ virtualenv virtualenv_name
+ ~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (virtualenv:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

Regards

Adrian
Reply
#5
Sounds like Python is not in you PATH. When you installed Python did you ask it to update environment variables?
Reply
#6
(Aug-07-2023, 06:17 PM)deanhystad Wrote: Sounds like Python is not in you PATH. When you installed Python did you ask it to update environment variables?

I dont recall, is it worth doing a clean re-install and if so how do i update the environment variables ?

Thanks for all your help

Adrian
Reply
#7
(Aug-07-2023, 06:00 PM)Adi44 Wrote: I am still confused about ow to create a virtual environment, i open the CMD window as suggested, and do not type "py" ?
Just use py to generate the environment.
py -m venv photo_env
Then the rest will be the same.

If Path is correct python and py will work the same.
Test with:
G:\div_code
λ python -V
Python 3.11.3

G:\div_code
λ py -V
Python 3.11.3

G:\div_code
λ pip -V
pip 23.1.2 from C:\python311\Lib\site-packages\pip (python 3.11)
py will always work as it dos not use OS environment path.

Virtualenv is 3-party libayr that need to install .
But is no not needed.
Quote:Since Python 3.3, a subset of it has been integrated into the standard library under the venv module.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Installing Github-programs AudunNilsen 1 244 Mar-22-2024, 04:28 PM
Last Post: deanhystad
  Looking for advice on funstionality of python bradkernohan 1 1,319 Feb-21-2022, 09:26 PM
Last Post: Larz60+
  Advice about Python pythonman13 4 2,624 Mar-21-2021, 07:22 PM
Last Post: jefsummers
  Running python scripts from github etc pacmyc 7 3,751 Mar-03-2021, 10:26 PM
Last Post: pacmyc
  How can I download Python files from GitHub? bitcoin10mil 2 2,855 Aug-26-2020, 09:03 PM
Last Post: Axel_Erfurt
  configure Github with python yellareddy 1 9,361 Apr-20-2020, 05:37 PM
Last Post: buran
  Advice on Setting Up the Python Environment punksnotdead 1 2,389 May-15-2019, 04:29 PM
Last Post: snippsat
  C++ programmer requests Python Web/database advice GregReese 3 75,034 Apr-10-2019, 09:41 PM
Last Post: snippsat
  Installing and running a python web scraping app from github to a windows 8.1 system eugenioca 17 8,250 Oct-06-2018, 08:14 AM
Last Post: eugenioca
  Need advice for learning python Nurram 1 2,885 Mar-28-2017, 06:28 AM
Last Post: wavic

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020