Install python dev package without yum - python

I'm currently trying to install a few modules via virtualenv, which I have bootstrapped at the moment, and so far pip and easy_install have been working fine. I am now trying to install the Sybase module; however, it seems I need gcc to install it as I'm getting the following output:
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.6
copying Sybase.py -> build/lib.linux-x86_64-2.6
running build_ext
building 'sybasect' extension
creating build/temp.linux-x86_64-2.6
gcc ...
unable to execute gcc: No such file or directory
error: command 'gcc' failed with exit status 1
----------------------------------------
I am now trying to install the python dev package which I'm assuming will solve my problem; however, I don't have network access from the command line and can't use yum install. Is there a way to install the python dev package from a tar.gz or some other method? or just gcc for virtualenv? My machine does not have a native gcc either and I can't get it at this stage.

Installing python-dev will not solve your problem as you miss GNU C compiler on your system.
Installing that one, will probably fix your issue. python-dev is a secondary and missing that one will result in different type of errors (namely missing headers during compilation process).
And.. if you can't get native gcc, I'm afraid you're out of luck at this point.

Related

BreakOut Detection Python/R Pkg Installation on Mac

I have been trying to install the BreakOut Detetction pkg (by Roland Hochmuth) in a MacOS Mojave environment.
Following is the pkg I am talking about, https://github.com/roland-hochmuth/BreakoutDetection
I was able to get swig on my machine by using homebrew.
The pkg details 3 steps to install:
swig -python -c++ breakout_detection.i
python setup.py build_ext -I../src build
sudo python setup.py build_ext -I../src install
I got the error with the first step and shows "Unable to find file 'breakout_detection.i'."
Then I try to swig with a detailed file paths, it somehow works with the first step.
However, the second step gives a lot of compilation errors and warnings.
One of the errors shows "error: command 'gcc' failed with exit status 1".
I was wondering if anyone has tried compiling this pkg.
I really want to know how this guy successfully compiled the pkg. (https://www.youtube.com/watch?v=fcsyL5TwIvE)
I found a way to simply solve this issue by putting codes in the breakout detection folder where "breakout_detection.py" is.
Then you can simply "import breakout_detection" library and use it.

Trouble Installing TA-Lib in Python 3.7

I am trying to install TA-Lib for Python 3.7. I've already read through a number of solutions, but have come to a point I can't figure out. Here is the message I get from pip:
Collecting ta-lib
Using cached https://files.pythonhosted.org/packages/90/05/d4c6a778d7a7de0be366bc4a850b4ffaeac2abad927f95fa8ba6f355a082/TA-Lib-0.4.17.tar.gz
Requirement already satisfied: numpy in c:\python37_64\lib\site-packages (from ta-lib) (1.15.4)
Installing collected packages: ta-lib
Running setup.py install for ta-lib: started
Command "c:\python37_64\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Todd\\AppData\\Local\\Temp\\pip-install-0c2__0gf\\ta-lib\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\Todd\AppData\Local\Temp\pip-record-3dpfanca\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\Todd\AppData\Local\Temp\pip-install-0c2__0gf\ta-lib\
Running setup.py install for ta-lib: finished with status 'error'
Complete output from command c:\python37_64\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Todd\\AppData\\Local\\Temp\\pip-install-0c2__0gf\\ta-lib\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\Todd\AppData\Local\Temp\pip-record-3dpfanca\install-record.txt --single-version-externally-managed --compile:
C:\Users\Todd\AppData\Local\Temp\pip-install-0c2__0gf\ta-lib\setup.py:79: UserWarning: Cannot find ta-lib library, installation may fail.
warnings.warn('Cannot find ta-lib library, installation may fail.')
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.7
creating build\lib.win-amd64-3.7\talib
copying talib\abstract.py -> build\lib.win-amd64-3.7\talib
copying talib\deprecated.py -> build\lib.win-amd64-3.7\talib
copying talib\stream.py -> build\lib.win-amd64-3.7\talib
copying talib\test_abstract.py -> build\lib.win-amd64-3.7\talib
copying talib\test_data.py -> build\lib.win-amd64-3.7\talib
copying talib\test_func.py -> build\lib.win-amd64-3.7\talib
copying talib\test_pandas.py -> build\lib.win-amd64-3.7\talib
copying talib\test_stream.py -> build\lib.win-amd64-3.7\talib
copying talib\__init__.py -> build\lib.win-amd64-3.7\talib
running build_ext
building 'talib._ta_lib' extension
creating build\temp.win-amd64-3.7
creating build\temp.win-amd64-3.7\Release
creating build\temp.win-amd64-3.7\Release\talib
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:\python37_64\lib\site-packages\numpy\core\include -Ic:\ta-lib\c\include -Ic:\python37_64\include -Ic:\python37_64\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt" /Tctalib/_ta_lib.c /Fobuild\temp.win-amd64-3.7\Release\talib/_ta_lib.obj
_ta_lib.c
talib/_ta_lib.c(524): fatal error C1083: Cannot open include file: 'ta_libc.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\VC\\Tools\\MSVC\\14.16.27023\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
----------------------------------------
FINISHED
Thanks.
Here is what works for me...
Download TA_Lib-0.4.10-cp27-cp27m-win_amd64.whl from here
And use command pip install TA_Lib-0.4.10-cp27-cp27m-win_amd64.whl
I was using Conda4 with python 3.6 64 bit version.
Another way also you can try
To install Ta-Lib with Python 3.6+, Windows 64 bit use this pip install -i https://pypi.anaconda.org/masdeseiscaracteres/simple ta-lib
The root cause of the error is probably because you haven't installed actual TA-Lib library which is written in C. Note that the python lib is just a wrapper on top of the actual library. So in order to have python wrapper successfully installed, you'll need to install its prerequisite (the actual TA-Lib).
See https://github.com/mrjbq7/ta-lib#dependencies for more details.
From above reference (for ease of access) :
Installing actual TA-Lib (prerequisite for python wrapper) :
Windows
Download ta-lib-0.4.0-msvc.zip and unzip to C:\ta-lib
Move the Unzipped Folder ta-lib to C:\
Download and Install Visual Studio Community 2015 if already not installed (Remember to Select [Visual C++] Feature)
open x64 Native Tools Command Prompt
navigate to C:\ta-lib\c\make\cdr\win32\msvc
type nmake (this command builds the library)
Linux
$ tar -xzf ta-lib-0.4.0-src.tar.gz
$ cd ta-lib/
$ ./configure --prefix=/usr
$ make
$ sudo make install
Mac OS X
$ brew install ta-lib
If you are using a M1 laptop and Homebrew, then you can set these before installing:
export TA_INCLUDE_PATH="$(brew --prefix ta-lib)/include"
export TA_LIBRARY_PATH="$(brew --prefix ta-lib)/lib"
Hint : It seems, by default, the setup.py reads actual library files from C:\ta-lib (in Windows) and /usr (in Linux). so if you move the downloaded zip file to another location and extract it there (for Windows) or set ./configure --prefix to any location other than /usr (for Linux), then you would have to set TA_LIBRARY_PATH and TA_INCLUDE_PATH environment variables to your desired locations.
If you installed the underlying TA-Lib library with a custom prefix (e.g., with ./configure --prefix=$PREFIX), then when you go to install this python wrapper you can specify additional search paths to find the library and include files for the underlying TA-Lib library using the TA_LIBRARY_PATH and TA_INCLUDE_PATH environment variables:
$ export TA_LIBRARY_PATH=$PREFIX/lib
$ export TA_INCLUDE_PATH=$PREFIX/include
$ python setup.py install # or pip install ta-lib
The documentation of Ta-lib package here is well clear:
https://github.com/mrjbq7/ta-lib
https://mrjbq7.github.io/ta-lib/
And as it was clearly mentionned! this python ta-lib library! Is a wrapper for the TaLib library at https://ta-lib.org/
This is a Python wrapper for TA-LIB based on Cython instead of SWIG
To know the ta-lib.org library is a library created in c lang! You can check here
And multiple binding and interfaces are made for different languages! Just as mentionned in the official website!
The python library is a binding for python that use cython! Which make it more efficient then SWIG!
Know that I'll insist on using pip! (it works all well and it's convenient)
For the installation to go well! You'll need to go in two steps! You need to install TaLib native library binaries first! Then install the python lib with pip (again with pip)! And this order is necessary! You can't go for installing the python binding before the first installation finish!
All that said!
Installation
Step 1: Installing Talib native binary
Installing the Ta-lib software (Or native library binary)! Is a must! And need to be done first!
Follow the instructions here:
https://github.com/mrjbq7/ta-lib#dependencies
The instructions are too clear and detailed!
(Linux users you need to execute the command with the right privelege (hince using sudo))
And last thing! You can check #Code_Worm answer in this thread here He explained many points highly well aboutt the instruction above !
I'll pin point too his hint:
Hint : It seems, by default, the setup.py reads actual library files from C:\ta-lib (in Windows) and /usr (in Linux). so if you move the downloaded zip file to another location and extract it there (for Windows) or set ./configure --prefix to any location other than /usr (for Linux), then you would have to set TA_LIBRARY_PATH and TA_INCLUDE_PATH environment variables to your desired locations.
Check the section bellow this hint!
You can check the trouble shooting section here
Step 2: Installing the python library using pip
Don't proceed with this step until the first step is successfully finished and done with!
Again the pip package and pip works well! And so no need to use some whl file from any other website and src! I'll show you how!
pip install TA-Lib
However here there is many things to say!
First you need to use python 3
So you may use pip3 instead of pip! If pip is resolving to the python2 version (which is common in linux installations)!
pip3 install TA-Lib
Now you may fall in this problem and error!
unescape = getattr(html, 'unescape', html_parser.HTMLParser().unescape)
AttributeError: 'HTMLParser' object has no attribute 'unescape'
IF such is the case! That's a problem that can come with python 3.9! (if you are using 3.8 you may not encounter that at all)!
The solution and fix is simple! We have just to make an upgrade to some packages! You can follow the instructions from the answer here:
https://stackoverflow.com/a/65640477/7668448
After some trial and error I upgraded, pip, distlib and setuptools and it solved it. Not sure which of those is causing it. (On the last two I found issues 1 2 of other sites)
It is caused by removing unescape from HTMLParser in python3.9, which seems to break setuptools.
pip3 install --upgrade setuptools
If it does not work, try also:
pip3 install --upgrade pip
pip3 install --upgrade distlib
That's it all! If the first step (step 1: Installing TaLib native binaries) is well done and finished! Then running pip3 install TA-Lib will works well this time!
For Linux users! If you run it with sudo! And it failed! Don't use sudo! You should not!
For linux users you may need to install python headers
sudo apt-get install python3-dev
You can try it only if it didn't works! In most linux distro! You'll be ok by default!
Last (Trouble shooting doc section)
If needed Check the trouble shooting section here
If you didn't installed first TA-lib native library (as mentioned here and installed python ta-lib first it helps to re-install TA-lib using: pip install --upgrade --force-reinstall TA-lib
i would suggest installing using the wheel from here. Recently i ran across the same problems while trying to upgrade the library which is again another thing you wouldn't want to do.
Hope this helps. Good luck.

No version attribute when install OR-tools

I'm trying to install OR-tools on Linux for Python, an optimization library by Google.
https://developers.google.com/optimization/introduction/installing.html#unix_binary
I'm using a freshly downloaded VM (Ubuntu 16.10 Yakkety Yak from OS boxes), so I doubt my system is the issue (unless ofc I haven't installed something I need).
I also doubt OR-tools is the issue. I've nothing to the VM except:
sudo apt-get install python-setuptools
sudo apt-get install g++
downloaded Python—tar.gz, extracted in Downloads
run "make install" after cding into Downloads
I get an error "You are using a ortools module that doesn't have a version attribute". Does anyone know what this might mean?
I've tried the two tips suggested by the command prompt:
Running /usr/bin/python setup.py install --user works, but the error "warning: install_lib: 'build/lib.linux-x86_64-2.7' does not exist -- no Python modules to install" pops up.
Removing the init.pyc file tells me to remove the init.py file, and then it says or-tools isn't found.
Any assistance is greatly appreciated, still learning Linux so I'm sure I'm doing something dumb....
Full output of make install:
python setup.py install --user
running install
running bdist_egg
running egg_info
writing requirements to ortools_examples.egg-info/requires.txt
writing ortools_examples.egg-info/PKG-INFO
writing top-level names to ortools_examples.egg-info/top_level.txt
writing dependency_links to ortools_examples.egg-info/dependency_links.txt
reading manifest file 'ortools_examples.egg-info/SOURCES.txt'
writing manifest file 'ortools_examples.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
warning: install_lib: 'build/lib.linux-x86_64-2.7' does not exist -- no Python modules to install
creating build/bdist.linux-x86_64/egg
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying ortools_examples.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying ortools_examples.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying ortools_examples.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying ortools_examples.egg-info/requires.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying ortools_examples.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating 'dist/ortools_examples-6.0.4217-py2.7.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing ortools_examples-6.0.4217-py2.7.egg
Removing /home/osboxes/.local/lib/python2.7/site-packages/ortools_examples-6.0.4217-py2.7.egg
Copying ortools_examples-6.0.4217-py2.7.egg to /home/osboxes/.local/lib/python2.7/site-packages
ortools-examples 6.0.4217 is already the active version in easy-install.pth
Installed /home/osboxes/.local/lib/python2.7/site-packages/ortools_examples-6.0.4217-py2.7.egg
Processing dependencies for ortools-examples==6.0.4217
Searching for ortools==6.0.4217
Best match: ortools 6.0.4217
Processing ortools-6.0.4217-py2.7-linux-x86_64.egg
ortools 6.0.4217 is already the active version in easy-install.pth
Using /home/osboxes/.local/lib/python2.7/site-packages/ortools-6.0.4217-py2.7-linux-x86_64.egg
Searching for protobuf==3.2.0
Best match: protobuf 3.2.0
Processing protobuf-3.2.0-py2.7.egg
protobuf 3.2.0 is already the active version in easy-install.pth
Using /home/osboxes/.local/lib/python2.7/site-packages/protobuf-3.2.0-py2.7.egg
Searching for setuptools==26.1.1
Best match: setuptools 26.1.1
Adding setuptools 26.1.1 to easy-install.pth file
Installing easy_install script to /home/osboxes/.local/bin
Using /usr/lib/python2.7/dist-packages
Searching for six==1.10.0
Best match: six 1.10.0
Processing six-1.10.0-py2.7.egg
six 1.10.0 is already the active version in easy-install.pth
Using /home/osboxes/.local/lib/python2.7/site-packages/six-1.10.0-py2.7.egg
Finished processing dependencies for ortools-examples==6.0.4217
python check_python_deps.py --log=ERROR
[ERROR] You are using a ortools module that doesn't have a version attribute : /home/osboxes/.local/lib/python2.7/site-packages/ortools-6.0.4217-py2.7-linux-x86_64.egg/ortools/init.pyc"
Run "/usr/bin/python setup.py install --user" to upgrade.
If the problem persists, remove the site-package that contains "/home/osboxes/.local/lib/python2.7/site-packages/ortools-6.0.4217-py2.7-linux-x86_64.egg/ortools/init.pyc". You can do so either manually or by using pip.
See the troubleshooting page of the Google or-tools project, where this error is elaborated on:
This occurs when you try to install a binary distribution, but the
installer is unable to build the ortools package for your operating
system. In this case, you can still install and run OR-Tools from
source files, and even build the python package yourself. You can do
so, by following these steps:
Install and compile OR-Tools as described in Linux/Mac OS X source installation or Windows source installation.
Don't forget to make sure that everything is working fine by running make test.
Run make pypi_archive. You will find the package under a directory called temp.
For me personally, building from the source files on my Ubuntu 16.04 VM did not work either (probably due to some error caused by virtualisation).
However, I found this Python .egg file on PyPi for or-tools on Ubuntu 16.04, which is fairly easy to install with easy_install <filename>.egg (make sure to download Python setuptools first with pip install setuptools).
They have these easy to install versions available for other versions of Ubuntu than yours, like 16.04 and 17.04. In case you are upgrading soon, you might want to try one of those. Otherwise, you can try to easy_install an OS-unspecific version .egg file.

how to install python libraries in linux?

While I was installing Python libraries on Linux, it threw the below error. How can I fix it?
I ran the below command to install:
python setup.py install
Output:
running install
running build
running build_ext
error: pyconfig.h: No such file or directory
The first thing to try is to install the appropriate module via your package manager. Each distro has many, many, many Python modules already packaged and ready to go.
If you insist on installing a module from source then you'll need the development package for your distro's Python. This is usually called python-devel, python-dev, or something similar. Use the package manager to install it.

Error when install python mysql module on windows?

When i try to install mysql on windows i get this error
MySQL-python-0.9.2>python setup.py build
running build
running build_py
running build_ext
building '_mysql' extension
error: Unable to find vcvarsall.bat
I guess, you don't have visual c++ compiler installed or compiler not in the PATH.
If you have mingw32, you can pass paramter -c mingw32
And mysql-python is available as binary in windows, you may not need to compile yourself.
UPDATE: OP is using python 2.6, no binaries for 1.2.3 in mysql-python page for windows.
Here is the one I have compiled before

Categories

Resources