Install python, pygtk in user's space - python

I am trying to install python with pygtk in my ubuntu system.
I don't have root access so I need to install all the packages locally say /home/user/local/lib
I am able to install python, but I am not able to link other packages(pygobject, pygtk, etc) to the locally installed python.
And if I try to install pygtk locally using the command
./configure --prefix=/home/shrihari/local/lib/pygtk2.24/
It gives the following error
checking for GLIB - version >= 2.8.0... yes (version 2.28.6)
checking for PYGOBJECT... yes
checking for gio-types.defs... no
checking for ATK... yes
checking for PANGO... yes
checking for codegen... configure: error: unable to find PyGObject codegen
My default python version is python2.4. If I try to import pygtk in python2.4 it works fine but i need pygtk in python2.7.
So how can I achieve this?
If there is any good documentation available for installing python, pygtk, pygobject locally in user space please share.
Thanks in advance

In general, to be able to link a build to something already installed, you need to have set up the LD_LIBRARY_PATH and (for Python modules) PYTHONPATH to the directories where you have installed that "something". So in this example, if you install Python 2.7 with prefix /home/shrinari/local/python27, you need afterwards set the system variables like this (for bash):
export LD_LIBRARY_PATH=/home/shrinari/local/python27/lib:$LD_LIBRARY_PATH
export PYTHONPATH=/home/shrinari/local/python27/lib/python2.7/site-packages:$PYTHONPATH
export PKG_CONFIG_PATH=/home/shrinari/local/python27/lib/pkgconfig:$PKG_CONFIG_PATH
And after that you can try to compile something dependent on your new Python installation.
But, according to the configuration error provided, I don't think this helps in your situation. It seems that you have something missing from PyGObject, maybe just header files, maybe some module (I don't know PyGObject specifics). Anyway, why the configure script can not find something is usually better visible from config.log file which can be found in the build directory after running the configure script.

This error is because of compatibility between pygobject and gobject-retrospection. To avoid this use Pygobject build earlier than 2.90.1 if your GTK is old. I Used following on CentOS 5.5 to make it work -
pygobject-2.28.6
When building pygobject disable introspection with --disable-introspection
gobject-retrospection 1.32.1

Related

How can I get neovim on windows to recognize python?

I think I'm not supposed to ask questions in other questions. This didn't answer my question Neovim on Windows can't find python provider
When I start neovim it says no python provider found. Run ":checkhealth provider".
checkhealth provider shows it found python 3 and that latest pynvim is installed. it also shows that python 2 is disabled (I set g:loaded_python_provider=0). I've also made a symbolic link to python.exe called python3.exe.
How can I get past this point?
You need to install a package that tell neovim how to use python. On arch Linux I had to install a package called python-neovim-git.
From what I've seen on windows, you probably need to install pynvim.

Robot Framework with Pycharm -- Autocomplete doesn't work

I've installed PyCharm with the robotframework support plugin.
The .robot files are identified successfully and I was able to create a simple script and run it in pyCharm.
However, my problem is that no keywords nor even the robotframework libraries (selenium2library) are recognized by pycharm in order to be autocompleted when typing them.
I also have the intellibot plugin installed.
Is there something that I'm missing? Is there another configuration file somewhere?
Thanks,
Try to set up your Library to robotframework-selenium2library == 1.8.0, then the issue will disappear.
If you have the last version it doesn't work for me.
My solution:
Uninstall the 'Robot framework support' (PyCharm/File/Settings/Plugins)
Uninstall 'Intellibot' (PyCharm/File/Settings/Plugins) (Uninstall all similar plugins!)
Exit PyCharm
Uninstall robotframework-seleniumlibrary (Open command prompt with administration mode: pip uninstall robotframework-seleniumlibrary)
Install robotframework-seleniumlibrary 3.3.1 (Command prompt: pip install robotframework-seleniumlibrary==3.3.1)
Open PyCharm
Install 'IntelliBot #SeleniumLibrary Patched' (PyCharm/File/Settings/Plugins)
(If it isn't working then try the following: PyCharm/File/Invalidate Caches/Restart... and click the 'Invalidate and Restart')
There is a bug in the intellibot plugin.
To resolve you need to
1. Uninstall your current intellibot plugin
2. Search for "IntelliBot #SeleniumLibrary Patched" in the plugins repository.
3. Install this patched plugin.
This worked for me.
You can try install "Robot Framework support" plugin.
it working for me.
use plugin Intellbot#SeleniumLibrary Patched
and robotframework-seleniumlibrary version 3.3.1
It works for me after lot of research from the internet
I recomend to use lte2000 fork: https://github.com/lte2000/intellibot
It works fine for me (Pycharm 2020.1, Robot Framework 3.2.2 and SeleniumLibrary 4.5.0)
In our main_resources.robot we need to give file path as below for the library files which contain definition of function
Library ../lib/SampleRest/SampleRest.py
When you do cntl+click on above SampleRest.py it should be navigated to that file
Your SampleRest.py should contain all your function definitions as below
try:
from .api import *
except:
from api import *
class SampleRest(
events,
repository,
devices
):
"""
This library will provides keywords to automating the cloud test cases
"""
ROBOT_LIBRARY_SCOPE = 'GLOBAL'
ROBOT_LIBRARY_VERSION = 1.0
def __init__(self):
for base in SampleRest.__bases__:
base.__init__(self)
Once I declare this I can use any of functions present in above devices.py file from robot file and it will be successfully navigated
Also please check your robotframework-seleniumlibrary version it should be 3.3.1 because for latest version navigation is an issue
I have been troubled by this for what seems to be forever.
Here are my configuration steps, and so far everything is working like a charm.
My setup:
Installed Python 3.9.x => added path to variables in "windows environment Variables" Check python and pip versions.
install selenium
install robotframework
install robotframework-seleniumlibrary
Install Pycharm and set Interpreter to Python 3.9.x
Install Plugin: "IntelliBot #SeleniumLibrary Patched" - Do not install Selenium2Library This is what causes the IDE issues.
Restart IDE and enjoy. And for those just getting into Robotframework, dont forget to add webdrivers.
For this I made a folder in root (called it webdrivers) and also added this to my Windows Enviro variables. This allows me to call them from any project folder.
I am going through the same problems... I've tried IntelliBot, IntelliBot #patched, Robot Framework Support plugins.
Now I am testing the Hyper RobotFramework Support plugin [link] and for now, looks the best from all of these.
With it I have some auto-complete support, also ctrl+click (navigation) works nice (better than in IntelliBot). Not perfect, but the best it has been so far.
I have installed:
PyCharm 2021.3.2
Python 3.10.2
Robot Framework 4.1.3
selenium 4.1.3
robotframework-seleniumlibrary 6.0.0
(on windows you can run the command pip list to see the version of the libraries that have been installed using pip)

wxPython for Framework distribution rather than Conda

I've been struggling with getting wxPython work - I'm running a Mac, OSX 10.11.6 El Captain, so the pip install runs into /src/osx/cocoa/mediactrl.mm:52:10: fatal error: 'QTKit/QTKit.h' file not found with the new XCode, and some changes there, and won't compile. So I found an installer, that at least gets it done.
But then wx runs (I only tried to import it in fact) in my conda python 2.7.12.
My goal is to be able to play around with TensorKart and since my default python is conda, when attempting to run the repo, it tells me the usual:
This program needs access to the screen.
Please run with a Framework build of python, and only when you are
logged in on the main display of your Mac.
I found how George Reilly explains here what to do, but I cannot find the wxredirect.pth and don't know what to do with the bash script. I only have wx.pth within the conda site-packages.
So is it somehow possible to get the wxPython for my Framework 2.7.10 with the .dmg installer? After 6 hours of struggle it seems like the easiest way.
I tried:
copy conda site-packages having to do with wxPython into site-packages within a virtualenv created form the Framework Python as it was in the original G. Reilly's post which no longer works.
create alias in .bash_profile that python is the Framework version but it didn't help.
Thanks a lot!

Basic Vim Installation, from Source Code

Tried installing Vim 7.3 so I first installed Mercurial, which allowed me to clone vim source code off Googlecode. This was done successfully.
Problem started from here:
cd vim/src
./configure --enable-pythoninterp --with-features=huge -prefix=$HOME/opt/vim
which drew this response from the terminal:
configure: loading cache auto/config.cache
checking whether make sets $(MAKE)... no
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/Users/JayEdge/vim/src':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details.
Tried looking at config.log (in my case it was auto/config.log) but I'm not sure what to look out for.
Background: I've checked that Xcode is installed properly, and gcc.vim was found inside the route vim/runtime/compiler. Should I move this (or duplicate this) into another folder? If so, which folder to move it into?
Like Karoly said, you need a c compiler. Since it looks like you are running OSX (based on your xcode comment I would suggest grabbing the OSX-GCC installer at the following site:
https://github.com/kennethreitz/osx-gcc-installer
I would also look into grabbing homebrew for installing things like vim.
Cheers,
Sean
no acceptable C compiler found in $PATH
That's a pretty clear error message, you need to install a compiler, if you haven't done sone.
Install gcc.
If you already installed gcc you have to add the path so configure can find it, eg:
export PATH="$PATH:/usr/bin"
Problem has been solved and here's to share with anyone if they have the same problems, specifically for people who install xCode via the app store after March 2012. (Credits to my Python Mentor, Martin)
Xcode from the app store currently only allows you to download the IDE, which is not what we want. What we want is the Apple Developer Tools, which you can get via https://developer.apple.com/xcode/ after signing up as a Apple Developer. Search for "Command Line Tools, late March 2012", install it and the configure command earlier should work properly.
Otherwise, you may refer to Sean's answer earlier.
FYI, I do intend to install homebrew but as a beginner, compiling it from source code is a great way of picking up some basics, interact with some basic syntax (or learn to parse them).
you can try it:
yum install gcc

How do I find out what Python libraries are installed on my Mac?

I'm just starting out with Python, and have found out that I can import various libraries. How do I find out what libraries exist on my Mac that I can import? How do I find out what functions they include?
I seem to remember using some web server type thing to browse through local help files, but I may have imagined that!
From the Python REPL (the command-line interpreter / Read-Eval-Print-Loop), type help("modules") to see a list of all your available libs.
Then to see functions within a module, do help("posix"), for example. If you haven't imported the library yet, you have to put quotes around the library's name.
For the web server, you can run the pydoc module that is included in the python distribution as a script:
python /path/to/pydoc.py -p 1234
where 1234 is the port you want the server to run at. You can then visit http://localhost:1234/ and browse the documentation.
Every standard python distribution has these libraries, which cover most of what you will need in a project.
In case you need to find out if a library exists at runtime, you do it like this
try:
import ObscureModule
except ImportError:
print "you need to install ObscureModule"
sys.exit(1) # or something like that
You can install another library: yolk.
yolk is a python package manager and will show you everything you have added via pypi. But it will also show you site-packages added through whatever local package manager you run.
just run the Python interpeter and type the command
import "lib_name"
if it gives an error, you don't have the lib installed...else you are good to go
On Leopard, depending on the python package you're using and the version number, the modules can be found in /Library/Python:
/Library/Python/2.5/site-packages
or in /Library/Frameworks
/Library/Frameworks/Python.framework/Versions/Current/lib/python2.6/site-packages
(it could also be 3.0 or whatever version)...
I guess it is quite the same with Tiger
Considering that in every operating system most of python's packages are installed using 'pip' (see pip documentation) you can also use the command 'pip freeze' on a terminal to print a list of all the packages you have installed through it.
Other tools like 'homebrew' for macOS (used when for some reason you can't install a package using pip) have similar commands, in this specific case 'brew list'.

Categories

Resources