Unable to install cherrypy on an offline server - python

Good Morning everyone, I am attempting to install CherryPy on a server without internet access. It has windows Server 2012. I can RDP to it, which is how i have attempted to install it. The server has Python 2.7 installed.
What I have tried (unsuccessfully):
RDP to the server, pip install cherrypy from command line (issue is that it is offline)
Downloaded the .grz files, RDP to server, from CL ran python (source to the setup.py file) install. says that there are dependencies that are unable to be downloaded (because offline).
Downloaded the whl file, attempted to run, did not work.
Is there a way to download the the package, along with all dependencies, on a remote computer (with internet access) and them copy the files over and install? I have attempted to find this information without success.
thank you all for your help.

Ended up copying my entire lib\site-packages folder to the remote server, placed where it would have been on my old server, and it worked fine.
TL:DR copy you %Python_home%/lib/site-packages folder to your remote machine and it might work. need to have the same version of python installed. In my case it was 2.7.

Related

Mounting a virtual environment via SSHFS on local machine using it's Python3 file not working

So I have mounted a part of a development server which hold a virtual environment that is used for development testing. The reason for this is to get access to the installed packages such as Django-rest-framework and Django itself and not having it set up locally (to be sure to use the same version as the development server has). I know that it's perhaps better to use Docker for this, but that's not the case right now.
The way I've done it is installing SSHFS via an external brew (as it's no longer supported in the brew core) - via this link https://github.com/gromgit/homebrew-fuse
After that I've run this command in the terminal to via SSH mount the specific part of the development server that holds the virtual enviornment:
sshfs -o ssh_command='ssh -i /Users/myusername/.ssh/id_rsa' myusername#servername:/home/myusername/projectname/env/bin ~/mnt/projectname
It works fine and I have it mounted on my local disk in mnt/projectname.
Now I go into VSCode and go into the folder and select the file called "python3" as my interpreter (which I should, right?). However, this file is just an alias, being 16 bytes in size. I suspect something is wrong here, but I'm not sure on how to fix it. Can someone maybe take a look and give some input? I'll attach a screenshot of the mounted directory.
Screenshot of virtualenv directory mounted on local machine
The solution to the problem was using the VSCode extension Remote - SSH and run VSCode directly in the remote location, and from there being able to access the virtual environment.

Code navigation for remote server in VS code

I have installed visual code in my mac to be able to access code to a remote server. I have installed remote-ssh and python packages for vs code and I have managed to connect remotely to my projects in server. However, my issue is while I can use python code navigation locally, I cannot do it in the server. Any ideas why?
Do I need to do any configuration in the remote server?
Check if the Pylance extension is installed on your remote extensions or not. I used to stick to this problem once so by installing the Pylance my problem was solved.

I am having difficulty importing code from a server?

I'm working on a project for a client and his code is running on his server. I've tried to download the code so that I can run a local version on my computer. The project is at least 5 years old and runs on Python 2.7.
The problem is I can't run python install -r requirements.txt without running into errors, because some of the files are no longer available. Specifically something called "sorl", "django-page-cms", "mercurial", and a few files the developer hosted on other sites.
If his website is working & the code is functioning on his server, that means there is a working version of these packages stored on the server? How could I find them?
You can try starting python while sshed into the server and doing an import like:
>>> import sorl
>>> sorl.__file__
'/home/jmunsch/PycharmProjects/projectname/venv_ok/lib/python3.6/sorl/__init__.py'
And if the os is the same then rsync the files over.
see:
- Copying files using rsync from remote server to local machine

Installing ReportLab onto Windows 64-bit server

I would like to install ReportLab onto a Windows Server 2012 R2 64-bit server from there is no internet access. I using Python 2.79 64-bit.
I went to this page using my workstation (not the server). Clicked on the link for reportlab-3.2.0-cp27-none-win_amd64.whl and thought I would get the .whl file. Instead, I was able to download the reportlab-3.2.0-cp27-none-win_amd64.zip file which contained two folders.
I then copied the zip file over to the server into the D:\Python27\Scripts folder.
What should I do to install ReportLab? I tried "pip install reportlab-3.2.0-cp27-none-win_amd64", but it tried to go out to the internet (which the server doesn't have access to).
Can somebody assist me with some instructions?
Thanks.

How do I deploy a python application to an external server?

I have written a python script on my local laptop which uses several third party packages. I now want to run my script regularly (via a cron job) on an external server.
The external server most likely does not have all the dependencies installed, is there is a way to package and deploy my python script and dependencies in order to ensure that it will run?
I have already tried to package the script as an exe, but failed to do so.
Not clear what kind of third party packages you have, but for those that were installed with pip, you can do this in your dev environment:
$ pip freeze > requirements.txt
And then you can install these packages in your production environment:
$ pip install requirements.txt
Ideally, you will already have a virtualenv on your production box. If not, it may be well worth reading about these before deploying your script.
Just turn your computer into a server. Simply set up your router for port forwarding so that your server's content's will display when the router's IP is entered. You can of course purchase a DNS domain to give that IP a human readable URL.

Categories