Python Forum
Struggling to set up Shared Hosting virtual envoronment
Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Struggling to set up Shared Hosting virtual envoronment
#1
This is my very first post so I do apologise in advance if I break any rules!! I've just spent 4 hours in an online chat to Namecheap to try to get a script to run online in a virtual environment.

I've got: index.php:

<?php
// echo $path = exec('pwd');

// exec python script
echo exec('python testpython.py');
?>
and testpython.py

# testpython.py
import sys
print (sys.version_info)
If I run these scripts in my public_html folder, in the root url/domain i.e. https//www.website.com/index.php I get, (2, 6, 6, 'final', 0) showing that I'm running Python 2.6.6.

Now I need Python 3, so I'm setting up a virtual environment running Python 3.7.3 using a cPanel App called "Setup Python App". So far so good, and I'm associating it with a sub-folder /pythontest/.

My understanding is that any code in the /pythontest/ folder should be running in the virtual environment and hence Python 3.7.3, but no matter what I do or where I upload the two files they seem to be running in Python 2.6.6.

Has anyone had this kind of experience? I'm sure I'm so close to sorting this out, but the support person in the online chat finally gave up.

I've got to the shell which is running 3.7.3 and managed to pip install a couple of modules so I know I've got a shell running 3.7.3, but I just don't know where to upload my files to in the cPanel file manager file structure so that they run in the virtual environment?
Reply
#2
If anyone else has a similar problem, I solved this very cheaply and effectively by switching hosts and going to Host Presto.

No further issues at all!!!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Hosting statistic tool on heroku with flask secure? Zoja 1 2,869 Oct-29-2018, 10:07 AM
Last Post: Zoja

Forum Jump:

User Panel Messages

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