install a python package for w python utility offline - python

I don't know python but I need to install a python utility. when running it using python ./main.py I am getting a message "No module named web" I downloaded the web.py .
My question is how to install it and where to put the webpy-master directory (that was downloaded when searching for the web.py ) or the web dir under it and what exactly to do
Note that I am running in an environment without web access so I can't just do pip install
and my python version is 2.7 (this is what the utility needs)
I saw this answer
Python Packages Offline Installation
but since I don't know python and i can't download other things ( it's complicated , need to go to security department etc ) also I don't understand how to use environment.txt
please don't set it as duplicate.

I put the Web directory where the main.py is and added
import web
to the main.py and it worked ! thank you !

Related

How do i install a Prject interpeter that cannot be found in the pycharm explorer

I am trying to install the huobi_python lib to my pycharm however i'm unable to do so. I have tried multiple times to add it and google it but did not succseed. Does anyone know how to fix this?
Github link:https://github.com/huobiapi/huobi_Python
Running windows 10, no i cannot find it in Project interpeter and with the + sign. Those are mostly REST api's
You wouldn't add it as an interpreter.
Since the project isn't available as pip install, you'd have to build it from source. Meaning clone the repo, and run the command listed in the installation section from the command prompt. Also make sure that you're using Python3.7, as listed there.
Your interpreter then would have to just be Python 3.7, which will allow you to import the modules from other Python code
from huobi import RequestClient
# your code

How to install python modules on mac

I'm a complete beginner in Python programming. I have trouble installing/importing the module 'requests' on python. When I use my command terminal to install requests, I get a message that requests is already installed. However, when I try to import requests into the file I'm working on, python tells me there is no such module installed.
Sorry to bother you with this silly and probably easy question, thanks in advance!
If you use PyCharm (which is a great choice in my opinion), go to the tab Run and select Edit Configuration and in the window that just opened make sure the your Python interpreter is the one you used when you pip installed the package you asked about.
You can check your Python version or just see in PyCharm if the requests is actually installed by going to the tab File, select Settings, click on Project: name_of_your_project and finally check in Project Interpreter that the package is installed.

setting up Django for internal web server ( from window to linux ) , what exactly do I need to install ?

I'm the beginner. I'm trying to deploy Django app to the internal web-server that is control by admin. The apache linux box with python 2.6 installed , but I am using 2.7 - on windows - other than following settings from http://www.djangobook.com/en/2.0/chapter12.html
My question is , what are the installations that I have to ask the admin to install in the linux box ?
Install Django following https://docs.djangoproject.com/en/dev/topics/install/
?
Python version : remove 2.6 and replaced with 2.7 python ? <- does it necessary ?
What about all the
packages ? For example I use pandas. I usually do
"pip install
pandas"
on my windows, do I need to ask admin to install that as well ?
If I don't use Django , but normal html - I usually just FTP to
/virtualhosts/mycompany.com/reports/www/index.html
and I would be able to see it. For Django I have >
mysite1/
manage.py
mysite2/
__init__.py
settings.py
urls.py
wsgi.py
Do i upload all mysite1 to replace index.html ( /virtualhosts/mycompany.com/reports/www/ ) ?
Sorry i am truly beginner here.
You should ask admin to install virtualenv so you will be able to install everything else on your own.
Anyway you will have to get ssh access to server to be able run your projects, so ask admin for it.
To install Django you just pip install django and you will get latest version
Python 2.7 is not necessary, but desirable since you might face problems on 2.6 like some modules you install might not be supported by 2.6 version
If you've followed official tutorial, yu should have been created requirements.txt in your projects, just find this file and send it to your admin, asking him to pip install -r requirments.txt. If not - you should read about this file cause it kind of must-have in project.
FTP upload - yes, you have to upload whole folder mysite1
I recommend you check out this thing, cause it is very easy and useful, especially if admin will help you to install it virtualenv wrapper
Edit: also consider installing Ubuntu alongside with Windows(it has such option out-of-box) You will fall in love with it for sure and will not be willing to return on Windows(except to play games if you do)

Mechanize not being installed by easy_install?

I am in the process of migrating from an old Win2K machine to a new and much more powerful Vista 64 bit PC. Most of the migration has gone fairly smoothly - but I did find that I needed to reinstall ALL of my Python related tools.
I've downloaded the mechanize-0.1.11.tar.gz file and ran easy_install to install it. This produced C:\Python25\Lib\site-packages\mechanize-0.1.11-py2.5.egg.
I then ran a python script to test it, and it worked fine under the interpreter. But, when I ran py2exe to compile the script, I get a message that mechanize cannot be found.
I then moved the egg to a new folder, used easy_install to install it - and got every indication that it did install.
But, I still get the same message when trying to use py2exe - that mechanize does not exist!
I did a search for "mechanize" of the entire disk, and get only the 2 egg files as a result. What files should be produced by the install - and where should I expect them to be located?
Obviously, I'm missing something here...any suggestions?
Also, perhaps related, the python I am running is the 32 bit 2.5.4 version...which is what I had before and wanted to get everything working properly prior to installing the 64 bit version - plus, I don't see some of the tools (easy_install & py2exe) which seem to support the 64 bit versions. Is that part of the problem, do I need to install & run the 64-bit version - and will that be a problem for those who run 32-bit PC's when they run my scripts?
There is a note on the py2exe site that it does not work if the source is in egg format:
py2exe does not currently (as of
0.6.5) work out of the box if some of your program's dependencies are in
.egg form.
If your program does not itself use
setuptools facilities (eg,
pkg_resources), then all you need to
do is make sure the dependencies are
installed on your system in unzipped
form, rather than in a zipped .egg.
One way to achieve this is to use the
--always-unzip option to easy_install.
Which version are you running? The latest version listed at pypi.python.org is version 0.6.9 but there is no indication I can find if the problem with eggs is fixed in this release.
As other users suggested as above... I hereby summarize the steps I need to make Mechanize and BeautifulSoup work with py2exe.
Converting .py Files to Windows .exe
Follow instructions in here: py2exe Tutorial
STEP 1
Download py2exe from here… http://sourceforge.net/projects/py2exe/files/
(I am using Python 2.7)
I installed 0.6.9 for Python 2.7
py2exe-0.6.9.win32-py2.7.exe (201KB)
Install it
STEP 2
Try a hello world file.. to make sure all works.. as given in
http://www.py2exe.org/index.cgi/Tutorial
Python setup.py install (step 2 on web tutorial)
Then use a setup.py (step 3 on web tutorial).
See Issues below for any problems with Modules (under this folder: C:\Python27\Lib\site-packages)
STEP 3
Test the executable file.. in the dist directory.
In summary, when you have problems with modules, make sure you visit the site packages directory.. and see if the full package is there instead of just the .egg file.
py2exe cannot make use of just the .egg file (a layman's understanding).
Issues:
Mechanize module was not found by py2exe.. this was due to my first installation of mechanize on my local machine was just an .egg file (mechanize-0.2.5-py2.7.egg.OLD 324KB).. I need to install the full mechanize like this:
easy_install --always-unzip <library_name>
I did that.. then this time mechanize was installed in a folder named mechanize-0.2.5-py2.7.egg (1.1MB).
Also beautifulsoup-3.2.0-py2.7.egg originally the .egg file was 69KB… and after installing with
easy_install -–always-unzip BeautifulSoup
it was installed in a folder named beautifulsoup-3.2.0-py2.7.egg (229KB).
Some instructions in here: http://www.daniweb.com/software-development/python/threads/204941

Installing python on 1and1 shared hosting

I'm trying to install python to a 1and1.com shared linux hosting account.
There is a nice guide at this address:
http://www.jacksinner.com/wordpress/?p=3
However I get stuck at step 6 which is: "make install". The error I get is as follows:
(uiserver):u58399657:~/bin/python > make install
Creating directory /~/bin/python/bin
/usr/bin/install: cannot create directory `/~’: Permission denied
Creating directory /~/bin/python/lib
/usr/bin/install: cannot create directory `/~’: Permission denied
make: *** [altbininstall] Error 1
I look forward to some suggestions.
UPDATE:
Here is an alternative version of the configure step to fix the above error, however this time I'm getting a different error:
(uiserver):u58399657:~ > cd Python-2.6.3
(uiserver):u58399657:~/Python-2.6.3 > ./configure -prefix=~/bin/python
configure: error: expected an absolute directory name for --prefix: ~/bin/python
(uiserver):u58399657:~/Python-2.6.3 >
The short version is, it looks like you've set the prefix to /~/bin/python instead of simply ~/bin/python. This is typically done with a --prefix=path argument to configure or some other similar script. Try fixing this and it should then work. I'd suggest actual commands, but it's been a while (hence my request to see what you've been typing.)
Because of the above mistake, it is trying to install to a subdirectory called ~ of the root directory (/), instead of your home directory (~).
EDIT: Looking at the linked tutorial, this step is incorrect:
./configure --prefix=/~/bin/python
It should instead read:
./configure --prefix=~/bin/python
Note, this is addressed in the very first comment to that post.
EDIT 2: It seems that whatever shell you are using isn't expanding the path properly. Try this instead:
./configure --prefix=$HOME/bin/python
Failing even that, run echo $HOME and substitute that for $HOME above. It should look something like --prefix=/home/mscharley/bin/python
You really should consider using the AS binary package from Activestate for this kind of thing. Download the .tar.gz file, unpack it, change to the python directory and run the install shell script. This installs a completely standalone version of python without touching any of the system stuff. You don't need root permissions and you don't need to mess around with make.
Of course, maybe you are a C/C++ developer, make is a familiar tool and you are experienced at building packages from source. But if any of those is not true then it is worth your while to try out the Activestate AS binary package.
I was facing same issue with 1and1 shared hosting (Your provided linked tutorial is not available now). I followed Installing Python modules on Hostgator shared hosting using VirtualEnv tutorial with only one change for 1and1. That is:
Instead of:
> python virtualenv-1.11.6/virtualenv.py /home1/yourusername/public_html/yourdomain.com/env --no-site-package
I used:
> python virtualenv-1.11.6/virtualenv.py /kunden/homepages/29/yourusername/htdocs/env --no-site-package
Rest of the instructions worked and I successfully installed VirtualEnv.
Example: 1and1 does not provide Requests module and pip cannot be used in shared hosting. This screenshot demonstrates that after installing VirtualEnv, pip command can be used and at the end >>> import requests successfully worked.

Categories

Resources