I am very new to python so sorry if this is a trivial question. I am developing on windows and I want to install the following library pymorph
I know it can be installed on linux but how to install it on windows enviroment ?
Thanks
Download the package. Extract the package, cd to the folder (make sure setup.py is in the folder) and run python setup.py install from your cmd while in said folder.
There are 2 main ways to install a python dependency.
First method
You can install pymorph (and almost all python dependencies) with the easy_install software. You can retrieve it here.
Example :
Run the setuptools-0.6c11.win32-py2.7.exe if you are using python version 2.7.
After that, you have the easy_install executable.
To install pymorph (in a shell, using cmd.exe) :
easy_install-2.7 pymorph
Don't forget to adapt the name of the easy_install executable with the good python version.
The advantage of this method is that it uses the Python Package Index :
According to Wikipedia :
The Python Package Index or PyPI is the official third-party software repository for the Python programming language. Python developers intend of it to be a comprehensive catalog of all open source Python packages.1 It is analogous to CPAN, the repository for Perl. Package managers such as EasyInstall, pip and PyPM use PyPI as the default source for packages and their dependencies.
Second method
In a shell, using the cmd.exe, go to the pymorph folder. After that, always in your shell :
python setup.py install
In a same way, python executable name can depend of the version of python. Example :
python2.7 for python version 2.7
Related
sorry if title is not clear. My problem is quite simple indeed but not sure if there is a solution out there:
I have requirements files with specific versions for each package (these requirements.txt files are also used by tox to execute pytest for py27 and py36).
Problem is that there is a python wrapper for a C library that must be installed with same version:
e.g. libawesomecbinaries-2.2.3 ==> pip install awesomepythonwrapper==2.2.3
The lib comes with a awesomec-config --version to check version installed.
Is there a way to instruct pip, tox and all the nice python tools to install a package with a specific version? Or do I have to use a bash script for that?
I am trying to run Matlab code using Python. I tried to follow the instructions given on this Mathworks page.
When trying to import Matlab though Python, it was installed using pip install matlab.
However, importing matlab.engine gives the error No module named 'matlab.engine'; 'matlab' is not a package. It cannot be installed using pip install engine either.
How can I get the code running? The Python code I'm running is as below:
import matlab.engine
eng = matlab.engine.start_matlab()
eng.triarea(nargout=0)
Python version - 3.5
Matlab version - 8.5.0.197613 (R2015a)
You need to install the Matlab Engine for Python, and it cannot be installed using pip. Try the instructions listed here. I have listed the instructions briefly below:
Make sure you have Python in your PATH.
Find the Matlab root folder. You can use the matlabroot command within Matlab to find it.
Go to the Matlab root folder in the command line.
cd "matlabroot\extern\engines\python" (In Windows)
python setup.py install
I was stuck on this for so long and I cant find a good explanation for it so here y'all go. There's a package for python called matlab here
And it has nothing to do with the matlab engine for python. When you pip install matlab it's installing this. I'm using pycharm and this is the default one it installed. I uninstalled this matlab and, instead, I copied the necessary information to my python project.
To do this, I located the folder named Matlab that is copied somewhere in AppData when you run python setup.py install in matlabroot/extern/engines/python and copied it to the lib folder in the venv of my python project since I'm using the virtual environment interpreter for pycharm.
pip install matlab gives you this, which installs a module with
from numpy import *
from pylab import *
inside. I'm quite sure this is not what you wanted...
I guess you tried importing the Matlab Compiler Runtime for Python. This has to be installed with the respective software from Mathworks though, it doesn't come through Python package index / pip. Check out the instrucions on their site.
You can visit to MATLAB official documentation: https://www.mathworks.com/help/matlab/matlab_external/install-the-matlab-engine-for-python.html
I have copied here as well.
Install Python Engine for Multiple MATLAB Versions
You can specify a MATLAB version to run from a Python script by installing the MATLAB Python packages to version-specific locations. For example, suppose that you want to call either MATLAB R2019a or R2019b from a Python version 3.6 script.
From the Windows system prompt, install the R2019a package in a subfolder named matlab19aPy36:
cd "c:\Program Files\MATLAB\R2019a\extern\engines\python"
python setup.py install --prefix="c:\work\matlab19aPy36"
Install the R2019b package in a matlab19bPy36 subfolder:
cd "c:\Program Files\MATLAB\R2019b\extern\engines\python"
python setup.py install --prefix="c:\work\matlab19bPy36"
From a Linux system prompt:
cd "/usr/local/MATLAB/R2019a/bin/matlab/extern/engines/python"
python setup.py install --prefix="/local/work/matlab19aPy36"
cd "/usr/local/MATLAB/R2019b/bin/matlab/extern/engines/python"
python setup.py install --prefix="/local/work/matlab19bPy36"
From a Mac Terminal:
cd "/Applications/MATLAB_R2019a.app/extern/engines/python"
python setup.py install --prefix="/local/work/matlab19aPy36"
cd "/Applications/MATLAB_R2019b.app/extern/engines/python"
python setup.py install --prefix="/local/work/matlab19bPy36"
I too did the same. Installed matlab using
pip install matlab
and got the same error No module named 'matlab.engine'; 'matlab' is not a package.
Then I checked the official documentation for installing MATLAB Engine API for Python, and followed the installation steps from there.
For me,
pip install matlabengine
solved the issue!
I have developed a tool that my team can use after running the setup.py script. The tool requires this library: https://github.com/c2nes/javalang
How can I make my python setup script install this library on their computer regardless of what OS they are on. They can't run my tool without that library (Some people are on windows, mac, and linux.)
pip can install projects on Github as a dependency too!
All you need to do is, in your requirements.txt, add a line like following:
..
git+https://github.com/c2nes/javalang.git
then install the dependency using:
$ pip install -r requirements.txt
What you are looking for exists on PyPI. Instead of git+https://.. line above, just say: javalang. Oh and BTW, unless they are running old versions of Python, they should already have pip installed. If they don't use your operating systems package manager or get-pip.py as you said.
I'm not overly familiar with Linux and am trying to run a Python script that is dependent upon Python 3.4 as well as pymssql. Both Python 2.7 and 3.4 are installed (usr/local/lib/[PYTHON_VERSION_HERE]). pymssql is also installed, except it's installed in the Python 2.7 directory, not the 3.4 directory. When I run my Python script (python3 myscript.py), I get the following error:
File "myscript.py", line 2, in
import pymssql
ImportError: No module named 'pymssql'
My belief is that I need to install pymssql to the Python 3.4 folder, but that's my uneducated opinion. So my question is this:
How can I get my script to run using Python 3.4 as well as use the pymssql package (sorry, probably wrong term there)?
I've tried many different approaches, broken my Ubuntu install (and subsequently reimaged), and at this point don't know what to do. I am a relative novice, so some of the replies I've seen on the web say to use ENV and separate the versions are really far beyond the scope of my understanding. If I have to go that route, then I will, but if there is another (i.e. easier) way to go here, I'd really appreciate it, as this was supposed to just be a tiny thing I need to take care of but it's tied up 12 hours of my life thus far! Thank you in advance.
It is better if when you run python3.4 you can have modules for that version.
Another way to get the desire modules running is install pip for python 3.4
sudo apt-get install python3-pip
Then install the module you want
python3.4 -m pip install pymssql
The easiest way is to use virtual environments instead of system paths or environment scripts. See official Python package installation guide.
All you need to do is to
# Create fresh Python environemnt
virtualenv -p python3.4 my-venv
# Activate it in current shell
source my-venv/bin/activate
# Install packages
pip install mysqlclent
Note that mysqlclient is Python 3.x compatible version.
I'm having trouble installing scipy via the binaries provided at http://sourceforge.net/projects/scipy/files/scipy/
Double clicking on the mpkg file after mounting the dmg installer gives the following error:
"scipy 0.13.0 can't be installed on this disk. scipy requires System Python 2.7 to install"
However, I already have python 2.7 and numpy installed. The python 2.7 came default with OSX Lion, so I assume it is System Python. With other python modules, one normally can download the binary then run
python setup.py install
Is there a way to cd through the mpkg file and locate a setup.py? Any advice install via this dmg installer?
I know there are other ways to manage python modules, like port and brew. However, I already installed a bunch of packages through setup.py, and I couldn't figure out how to get port to recognize those packages (for example, it will try to reinstall python and numpy via port)
Thanks!
If you have Mavericks and XCode 5, then you'll have to install Command Line Tools manually from the Apple Developer Site. I found this helpful post
You've got a few misconceptions here.
With other python modules, one normally can download the binary then run python setup.py install
No, that's what you do with source packages.
Is there a way to cd through the mpkg file and locate a setup.py?
No. What's inside an mpkg are pkg files. Which are filled with xar archives filled with cpio archives. Inside there is the built version of SciPy—that is, the files that setup.py would have copied to your site-packages if you'd run it—not the source package.
But you can download the source package yourself.
Or, better, let pip (or easy_install, but pip is better) download and run the setup.py for you.
Any advice install via this dmg installer?
If it won't work, my advice would be to not use it, and instead install with pip.
This blog post explains it, but I'll give you the details relevant to you below.
I know there are other ways to manage python modules, like port and brew. However, I already installed a bunch of packages through setup.py, and I couldn't figure out how to get port to recognize those packages.
You can't. MacPorts will not touch your system Python; it builds its own separate Python 2.7, with a completely independent site-packages directory and everything else. You would have to reinstall everything for this second Python 2.7. And deal with the confusion of having two Python 2.7 installations on the same machine.
Don't do that unless you absolutely have to.
In fact, if you want to use Homebrew for anything (and you do, see below), uninstall MacPorts, unless you really need it for something.
So, here are the steps:
Uninstall MacPorts.
I assume you already have Xcode and its Command Line Tools.
I assume you already have Homebrew.
Install a Fortran compiler with brew install gfortran.
Lion's Python 2.7 comes with easy_install, but not pip. So sudo easy_install pip to fix that. While you're at it, I'd suggest sudo easy_install readline, because you'll want that for ipython, and it won't work right with pip.
Apple's pre-installed NumPy has to be upgraded, and rebuilt with Fortran support, to make SciPy work. Fix that with sudo pip install --upgrade --force-reinstall numpy.
If you want ipython, pandas, etc. sudo pip install each of them as well.
In case you're considering upgrading soon, the exact same steps worked for me with OS X 10.9.0, except for some extra work to get the Xcode 5 command line tools set up.