I am using paraview 4.3.1 in Centos 7. There is a built-in python named pvpython:
Python 2.7.2 (default, Jan 15 2015, 09:36:49)
[GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys;sys.path
['', '/tmp/ParaView-4.3.1-Linux-64bit/lib/paraview-4.3/site-packages/vtk', '/tmp/ParaView-4.3.1-Linux-64bit/lib/paraview-4.3/site-packages', '/tmp/ParaView-4.3.1-Linux-64bit/lib/paraview-4.3', '/tmp/ParaView-4.3.1-Linux-64bit/lib/paraview-4.3/lib/python27.zip', '/tmp/ParaView-4.3.1-Linux-64bit/lib/paraview-4.3/lib/python2.7', '/tmp/ParaView-4.3.1-Linux-64bit/lib/paraview-4.3/lib/python2.7/plat-linux2', '/tmp/ParaView-4.3.1-Linux-64bit/lib/paraview-4.3/lib/python2.7/lib-tk', '/tmp/ParaView-4.3.1-Linux-64bit/lib/paraview-4.3/lib/python2.7/lib-old', '/tmp/ParaView-4.3.1-Linux-64bit/lib/paraview-4.3/lib/python2.7/lib-dynload', '/tmp/ParaView-4.3.1-Linux-64bit/lib/paraview-4.3/lib/python2.7/site-packages']
>>>
The problem is, original pvpython do not support many useful features such as code completion. And there is no setup_tools in the pvpython, so I cannot install new modules to the built-in python.
Could anyone help me to install ipython on this built-in python?
See the install instructions for get-pip:
https://pip.pypa.io/en/latest/installing.html
However, you must use the pvpython instead of python when using the install instructions.
Depending on how you install it, you may end up with more than one easy_install or pip on your path. Just make sure you're using the one associated with pvpython - look at the script you're running to find out (it's just a shell script).
Once you've done that, installing ipython should be the same as installing it with any other version of python (assuming that pvpython doesn't break anything that ipython needs).
Related
I know this question has been asked - but none of the solutions there seem to be working. I recently found out that on Mac OS, the native installation of python isn't very good. So, I installed homebrew, and installed Python 2 through there. My path is as follows:
~ echo $PATH
/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin
However, I still get the following:
~ which python
/usr/bin/python
~ which python2
/usr/local/bin/python2
It's also probably important to note that my ~/.bash_profile, ~/.profile and ~/.zshrc files are empty.
Somehow, I think I got pip to work with the python2 (homebrew) installation. Basically, I did pip install pandas and I get the following outputs for the two python interpreters:
~ python
Python 2.7.10 (default, Feb 7 2017, 00:08:15)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named pandas
That is, it doesn't appear with the default python installation. However, I also have the following:
~ python2
Python 2.7.14 (default, Sep 25 2017, 09:53:22)
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.37)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas
>>>
So, pandas is imported in the python2 (homebrew) python, but not the standard one. How can I get it so that the default python is my homebrew python? I also read somewhere that brew link python would work, but when I do that I get
~ brew link python
Warning: Already linked: /usr/local/Cellar/python/2.7.14
To relink: brew unlink python && brew link python
I want to be able to just use python my_file.py and have it use the homebrew installation. (Not sure if it's related, but hopefully this would also allow Sublime to use the homebrew install when I hit command + B).
Sorry for the long post, new computer and I'm trying to get this all correct before I do any big projects and find out halfway through that things aren't working the way I need them to.
Thanks!
The macOS system Python is installed at /usr/bin/python. This is the only one called python on your path.
Homebrew doesn't create a link for python in /usr/local/bin. If you want one you can create it yourself:
ln -s /usr/local/bin/python2 /usr/local/bin/python
Alternatively, just update your shebang lines to specify python2 or python3, which is probably better anyway (explicit is better than implicit).
I have installed Anaconda but still unable to use packages such as pandas and requests when running code on python.
When I input python on Terminal, it shows:
Python 3.6.1 |Anaconda 4.4.0 (x86_64)| (default, May 11 2017, 13:04:09)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
And I also created a virtual environment and activate before opening the python shell:
conda create -n my-env python=3.6 anaconda
However, when reopening and running codes on Python, it kept saying "No module named 'pandas' or "No module named 'requests'" Does anyone know what the problem with this code is? Besides, I am not if version of Python has anything to do with this error? Is it because I am using 3.6.2 Python instead of 3.6.1?
Probably Anaconda became the default Python installation on your system. Specially when you are using a new environment, you have to install the modules you want in this new environment.
Try conda install pandas and, after that, import pandas
linux python and pillow:
I just upgraded to mint 17.3. The docs say this is an Ubuntu14.04 Kernel.
I wish to run python and the python imaging libarary => pillow.
When I run > python < (command line) i get as follows;
grumpy#grumpy-desktop ~ $ python
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
I am assuming that python2.7.6 is the default module used. Within usr/
lib/ python2.6, python2.7, python3 and python3.4 all exist.
However; I have been unable to get the version of PIL or Pillow being used.
PIL exist in usr/lib/python3/dist-packages/PIL, along with
~/Pillow2.3.0.eggs-info (not much help here.)
The docs indicate that Linux mint17.3, with an Umbuntu14.04 Kurnel and
python2.7, that Pillow2.3.0 would be most compatable.
So the question is; How to install Pillow2.3.0, with ALL THE MODULES,
for full functionality. I wish to include in scripts;
Image.putpixel(xy, value)
Image.putdata(data, scale=1.0, offset=0.0)
At present when I run the above I get;
AttributeError: 'module' object has no attribute 'putdata' (or 'putpixel')
or, if needed;
How to change python version used, so to install another Pillow version
with full functionality.
Thanks for the input guys.
I have installed on Mac OS X 10.10:
I have installed Python 2.7.6 default apple
2.7.9 python mac ports
and
Pypy.
When i type pip freeze there a lot of modules installed.
However i can import some modules on one python and not the other one, because not everybody finds all modules.
Can someone explain me how can i achieve that every python version find every installed module?
(and does pip show all installed modules?)
As far as i can tell all modules are at : /Library/Python/2.7/sites-packages. But i don't know why not every python looks there.
How about using virtualenv to manage multiple python? https://virtualenv.pypa.io/en/latest/
If you are not sure about which module you are importing, you could try to print the file of the module ( if the module has this attribute). eg:
macbook:~ mac$ python
Python 2.7.5 (default, Mar 9 2014, 22:15:05)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import PyQt4 as f
>>> print f.__file__
/Library/Python/2.7/site-packages/PyQt4/__init__.pyc
python will search the PYTHONPATH setting and try to load the module, if there are multiple python module with same name, it actually loads the 1st one.
Hi im running a subprocess with threads trough a python wrapper and I get the following warning when I use the subprocess module.
"The _posixsubprocess module is not being used, Child process reliability may suffer if your program uses threads."
What dose this mean?
How can I get rid of it?
check if you can import _posixsubprocess manually, subprocess tries to import this in it's code, if it produces an exception this warning is produced.
unsetting PYTHONHOME has fixed this issue for me.
I had the same issue with a tool that was installed with conda. Turned out that there was kind of a conflicting version of subprocess32 that came from pip. Running this did the trick:
pip uninstall subprocess32
conda install -c conda-forge subprocess32
The solution for me was to do the following:
pip uninstall subprocess32
pip install -U subprocess32
Intially, I was getting a warning when I tried to import matplotlib:
Python 2.7.13 (default, May 16 2017, 12:02:12)
[GCC 6.2.0 20160901] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib
/home/methuselah/.local/lib/python2.7/site-packages/subprocess32.py:472: RuntimeWarning: The _posixsubprocess module is not being used. Child process reliability may suffer if your program uses threads.
"program uses threads.", RuntimeWarning)
>>>
After reinstalling subprocess32, the warning goes away:
Python 2.7.13 (default, May 16 2017, 12:02:12)
[GCC 6.2.0 20160901] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib
>>>
It could be if you have more than a version of Python in use.
you need to specify the correct version of python to use for each programme.
For example, I need python 3.7 for miniconda, but mendeleydesktop claims for trouble with this version:
also problem with _posixsubproces and its location
so instead of run the program in a phyton enviroment only I use python2.7, and it solve the problem.
Hope it helps.
Cheers,
Flor