Install GDAL in virtualenvwrapper environment - python

I tried to install gdal (pip install gdal)in virtualenvwrapper environment but I got this error :
error: command 'gcc' failed with exit status 1
----------------------------------------
Failed building wheel for gdal
Failed to build gdal
I tried also "pip install --no-install GDAL" but there is nooption --no-install
what should I do !?

Yes, installing GDAL in a venv is a doozy. Conveniently, I just wrote up the documentation on how to do so for my advisor's lab! While I am not savvy enough to pinpoint the exact cause of your error, I can give you a bunch of things to try to fix it.
First, ensure you have gdal installed on the host (i.e. not in a venv). I just run the following:
sudo apt-get install libgdal1i libgdal1-dev libgdal-dev
Now run gdal-config --version to get the version that apt-get provided you with. For example I get 1.11.3
Now, the easiest way in my experience to get the python bindings in a venv is using pygdal. The trick is to get the right version! To do so, activate your virtual environment and run
pip install pygdal==1.11.3
but replace the version with whatever you got from gdal-config --version. Note: you may get an error that says
Could not find a version that satisfies the requirement pygdal==1.11.3 (from versions: 1.8.1.0, 1.8.1.1, 1.8.1.2, 1.8.1.3, 1.9.2.0, 1.9.2.1, 1.9.2.3, 1.10.0.0, 1.10.0.1, 1.10.0.3, 1.10.1.0, 1.10.1.1, 1.10.1.3, 1.11.0.0, 1.11.0.1, 1.11.0.3, 1.11.1.0, 1.11.1.1, 1.11.1.3, 1.11.2.1, 1.11.2.3, 1.11.3.3, 1.11.4.3, 2.1.0.3) No matching distribution found for pygdal==1.11.3
If that happens, run the pip install again but with the highest version that still matches. e.g. in this case you would run pip install pygdal==1.11.3.3
Once pygdal has been successfully installed, you should be able to call
>>> from osgeo import gdal
Please let me know if anything fails and I'll do what I can to adjust my instructions. Also, if you need help with Proj.4, GEOS, or Cartopy, I have some experience there too.

use pygdal
pd#asghar:~$sudo apt-get install python3-gdal
pd#asghar:~$ virtualenv -p python3 test
Running virtualenv with interpreter /usr/bin/python3
Using base prefix '/usr'
New python executable in /home/pd/test/bin/python3
Also creating executable in /home/pd/test/bin/python
Installing setuptools, pip, wheel...done.
pd#asghar:~$ gdal-config --version
2.1.3
pd#asghar:~$ test/bin/pip install pygdal==2.1.3
Collecting pygdal==2.1.3
Could not find a version that satisfies the requirement pygdal==2.1.3 (from versions: 1.8.1.0, 1.8.1.1, 1.8.1.2, 1.8.1.3, 1.9.2.0, 1.9.2.1, 1.9.2.3, 1.10.0.0, 1.10.0.1, 1.10.0.3, 1.10.1.0, 1.10.1.1, 1.10.1.3, 1.11.0.0, 1.11.0.1, 1.11.0.3, 1.11.1.0, 1.11.1.1, 1.11.1.3, 1.11.2.1, 1.11.2.3, 1.11.3.3, 1.11.4.3, 1.11.5.3, 2.0.0.3, 2.0.1.3, 2.0.2.3, 2.0.3.3, 2.1.0.3, 2.1.1.3, 2.1.2.3, 2.1.3.3, 2.2.0.3)
No matching distribution found for pygdal==2.1.3
pd#asghar:~$ test/bin/pip install pygdal==2.1.3.3
Collecting pygdal==2.1.3.3
Collecting numpy>=1.0.0 (from pygdal==2.1.3.3)
Using cached numpy-1.13.1-cp35-cp35m-manylinux1_x86_64.whl
Installing collected packages: numpy, pygdal
Successfully installed numpy-1.13.1 pygdal-2.1.3.3
pd#asghar:~$ source test/bin/activate
(test) pd#asghar:~$ python
Python 3.5.2 (default, Nov 17 2016, 17:05:23)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from osgeo import gdal
>>>

On MacOS, first do brew install:
brew install gdal
Then do pip install:
pip install gdal

Related

Why am I unable to import the pcse (python crop simulation environment) into my jupyter notebook and how do I fix it?

I installed pcse using this user guide: https://pcse.readthedocs.io/en/stable/user_guide.html#getting-started . I am unable to import the package in jupyter notebook while I have the environment activated in the miniconda terminal.
(base) C:\Users\merej>activate py3_pcse
(py3_pcse) C:\Users\merej>
I don't know if I'm required to add the virtual environment to jupyter notebook in order to use it so I added it using
pip install --user ipykernel
python -m ipykernel install --user --name=py3_pcse
The Kernel shows up in Jupyter notebook;However, Jupyter notebook is unable to connect to the notebook server. This is not a problem when I create a python3 notebook.
I saw that this may be a problem with Tornado so I uninstalled my current tornado, installed tornado 5.1.1, got an error message saying the tornando 5.1.1 would not work with my current version of jupyter notebook, uninstalled tornado 5.1.1, and reinstalled the updated version of tornado.
(py3_pcse) C:\Users\merej>pip uninstall tornado
Found existing installation: tornado 6.2
Uninstalling tornado-6.2:
Would remove:
c:\users\merej\miniconda3\envs\py3_pcse\lib\site-packages\tornado-6.2.dist-info\*
c:\users\merej\miniconda3\envs\py3_pcse\lib\site-packages\tornado\*
Proceed (Y/n)? y
Successfully uninstalled tornado-6.2
(py3_pcse) C:\Users\merej>pip install tornado==5.1.1
Collecting tornado==5.1.1
Downloading tornado-5.1.1.tar.gz (516 kB)
---------------------------------------- 516.8/516.8 kB 550.0 kB/s eta 0:00:00
Preparing metadata (setup.py) ... done
Building wheels for collected packages: tornado
Building wheel for tornado (setup.py) ... done
Created wheel for tornado: filename=tornado-5.1.1-cp38-cp38-win_amd64.whl size=449834 sha256=160b8413fde8328df013e8729e86a92138e32c365dc6d9dc97a3e04b6cca17ea
Stored in directory: c:\users\merej\appdata\local\pip\cache\wheels\25\a1\e3\b0d37c6c451fc21f290cf026f6352382e6cbced32dc3f6a37a
Successfully built tornado
Installing collected packages: tornado
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
notebook 6.4.12 requires tornado>=6.1, but you have tornado 5.1.1 which is incompatible.
jupyterlab 3.4.4 requires tornado>=6.1.0, but you have tornado 5.1.1 which is incompatible.
jupyter-server 1.18.1 requires tornado>=6.1.0, but you have tornado 5.1.1 which is incompatible.
jupyter-client 7.3.5 requires tornado>=6.2, but you have tornado 5.1.1 which is incompatible.
ipykernel 6.15.2 requires tornado>=6.1, but you have tornado 5.1.1 which is incompatible.
Successfully installed tornado-5.1.1
(py3_pcse) C:\Users\merej>pip uninstall tornado
Found existing installation: tornado 5.1.1
Uninstalling tornado-5.1.1:
Would remove:
c:\users\merej\miniconda3\envs\py3_pcse\lib\site-packages\tornado-5.1.1.dist-info\*
c:\users\merej\miniconda3\envs\py3_pcse\lib\site-packages\tornado\*
Proceed (Y/n)? y
Successfully uninstalled tornado-5.1.1
(py3_pcse) C:\Users\merej>pip install tornado
Collecting tornado
Using cached tornado-6.2-cp37-abi3-win_amd64.whl (425 kB)
Installing collected packages: tornado
Successfully installed tornado-6.2
This Jupyter notebook: https://github.com/ajwdewit/pcse_notebooks/blob/master/01%20Getting%20Started%20with%20PCSE.ipynb doesn't say anything about a kernel so perhaps I installed pcse into the wrong place. My installation passes all of the tests that are listed in the user guide using the miniconda terminal. I saw that this may be a problem with the version of pip that I used to install it since pcse uses python version 3.8; However, I believe that I am using the correct version of pip.
(py3_pcse) C:\Users\merej>pip --version
pip 22.2.2 from C:\Users\merej\miniconda3\envs\py3_pcse\lib\site-packages\pip (python 3.8)
(py3_pcse) C:\Users\merej>python --version
Python 3.8.13
Then I thought it may be a path problem so I made a python path in jupyter notebook using the path given by using python in the miniconda terminal but that also did not work.
(py3_pcse) C:\Users\merej>python
Python 3.8.13 (default, Mar 28 2022, 06:59:08) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pcse
>>> pcse.__path__
['C:\\Users\\merej\\miniconda3\\envs\\py3_pcse\\lib\\site-packages\\pcse']
My level of understanding of all this is relatively low so feel free to explain anything you might find helpful.
Thanks!
tl;dr: You want to import pcse, but your jupyter kernel cannot yet do that.
You have correctly diagnosed this as being a virtual-environment issue.
And you're using conda, so the battle is half won already!
You chose to name your conda environment "py3_pcse", a perfectly good name.
That environment contains both PCSE and Jupyter dependencies.
Start by trying this in the base environment:
$ python -c 'import pcse'
Notice that, unsurprisingly, it fails.
Now $ conda activate py3_pcse, repeat the import, notice that it (silently) succeeds.
Here is the critically important piece.
While the environment is still active,
start the kernel with $ jupyter notebook
If the cPython interpreter could access pcse,
then the jupyter kernel will be able to, also.
Verify, by importing within a cell.

How does one install PyTorch and related tools from within the setup.py install_requires list?

I was trying to test the pip install -e . on my library ultimate-utils after changing laptops but I keep getting errors of this type:
(uutils_env) brandomiranda~/ultimate-utils ❯ pip install -e .
Obtaining file:///Users/brandomiranda/ultimate-utils
Preparing metadata (setup.py) ... done
ERROR: Could not find a version that satisfies the requirement torchvision==0.10.1 (from ultimate-utils) (from versions: 0.1.6, 0.1.7, 0.1.8, 0.1.9, 0.2.0, 0.2.1, 0.2.2, 0.2.2.post2, 0.2.2.post3)
ERROR: No matching distribution found for torchvision==0.10.1
or
(uutils_env) brandomiranda~/ultimate-utils ❯ pip install -e .
Obtaining file:///Users/brandomiranda/ultimate-utils
Preparing metadata (setup.py) ... done
ERROR: Could not find a version that satisfies the requirement torch==1.9.1 (from ultimate-utils) (from versions: none)
ERROR: No matching distribution found for torch==1.9.1
where it seems it stopped working to install anything related to pytorch for some reason.
I tried updating pip and conda but it did not work. I did:
pip install --upgrade pip
conda update conda
conda update conda-build
conda update -n base -c defaults conda
conda update --name base conda
conda update --all
conda install anaconda
but none seem to work.
my setup.py looks as follows:
"""
conda create -n uutils_env python=3.9
conda activate uutils_env
conda remove --all --name uutils_env
rm -rf /Users/brando/anaconda3/envs/uutils_env
pip install -e ~/ultimate-utils/ultimate-utils-proj-src/
pip install ultimate-utils
To test it:
python -c "import uutils; uutils.hello()"
python -c "import uutils; uutils.torch_uu.hello()"
python -c "import uutils; uutils.torch_uu.gpu_test_torch_any_device()"
python -c "import uutils; uutils.torch_uu.gpu_test()"
PyTorch:
basing the torch install from the pytorch website as of this writing: https://pytorch.org/get-started/locally/
pip3 install torch==1.9.1+cu111 torchvision==0.10.1+cu111 torchaudio==0.9.1 -f https://download.pytorch.org/whl/torch_stable.html
refs:
- setup tools: https://setuptools.pypa.io/en/latest/userguide/package_discovery.html#using-find-or-find-packages
"""
from setuptools import setup
from setuptools import find_packages
import os
# import pathlib
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='ultimate-utils', # project name
version='0.5.3',
description="Brando's ultimate utils for science, machine learning and AI",
long_description=long_description,
long_description_content_type="text/markdown",
url='https://github.com/brando90/ultimate-utils',
author='Brando Miranda',
author_email='brandojazz#gmail.com',
python_requires='>=3.9.0',
license='MIT',
package_dir={'': 'ultimate-utils-proj-src'},
packages=find_packages('ultimate-utils-proj-src'), # imports all modules/folders with __init__.py & python files
# for pytorch see doc string at the top of file
install_requires=[
# 'torch==1.9.1',
'torchvision==0.10.1',
'torchaudio==0.9.1',
'dill',
'networkx>=2.5',
'scipy',
'scikit-learn',
'lark-parser',
'torchtext==0.10.1',
'tensorboard',
'pandas',
'progressbar2',
'transformers',
'requests',
'aiohttp',
'numpy',
'plotly',
'wandb',
'matplotlib',
# 'seaborn'
# 'pygraphviz' # removing because it requires user to install graphviz and gives other issues
]
)
the dir structure is simple:
How do I fix this and what is not working?
I am trying to avoid having to run pip commands outside like:
conda install pytorch torchvision torchaudio -c pytorch
at least for cpu in my local laptop...if I can install gpu ones automatically with a flag it could be nice but for future work...
Btw, I prefer no requirements.txt solutions if possible, but post those too in case nothing else works.
This is for an intel mac 2013, but I will have an m1 max in 2 months, so those answers are also welcomed!
still fails:
(uutils_env) brandomiranda~/ultimate-utils ❯ pip install -e .
Obtaining file:///Users/brandomiranda/ultimate-utils
Preparing metadata (setup.py) ... done
ERROR: Could not find a version that satisfies the requirement torch<1.10.0,>=1.4.0 (from ultimate-utils) (from versions: none)
ERROR: No matching distribution found for torch<1.10.0,>=1.4.0
Related resources I tried:
https://docs.conda.io/projects/conda-build/en/latest/install-conda-build.html
PackageNotInstalledError: Package is not installed in prefix
Installing PyTorch with CUDA in setup.py
https://github.com/brando90/ultimate-utils
https://pytorch.org/get-started/locally/
https://discuss.pytorch.org/t/how-does-one-install-pytorch-and-related-tools-from-within-the-setup-py-install-requires-list/138976
How does one install PyTorch and related tools from within the setup.py install_requires list?
https://www.reddit.com/r/pytorch/comments/rcprlk/how_does_one_install_pytorch_and_related_tools/
Could not find a version that satisfies the requirement torch>=1.0.0?
See this Why is python using 3.8.1 and 3.9, then fail to install packages (ERROR: Package pkg requires a different Python: 3.8.1 not in '>=3.9.0')? for a more complete answer but the summary is that pytorch seems to not be working right now reliable with python 3.10 so I created an env with 3.9 and then it installed what I needed.

Fatal error in launcher: Unable to create process using pip.exe

Fatal error in launcher: Unable to create process using '"c:\users\owner\appdata\local\programs\python\python37-32\python.exe" "C:\Python37-32\Scripts\pip.exe" install pygame'
I have been trying to use pip installations in command prompt for the past while now and keep getting this issue. the first file location now no longer exists. Can anyone help me with this problem please ?
When we are looking at the execution file of pip, we can see the major entry file of python that pip is using, modify it to right path, and its done!
Or as described in https://stackoverflow.com/a/55210770/7621301 , you can reinstall pip.
Uninstall your current python and its launcher from control penal
Then download new python version and install it
While installing new one make sure you tick Add Launcher to all users(recommended) and ADD python to PATH both.
Now click customized install and tick all the boxes and install it
After install complete open powershell or cmd and type python to check it is
installed properly if you see:
PS C:\Users\Rohit> python
Python 3.10.0 (tags/v3.10.0:b494f59, Oct 4 2021, 19:00:18) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
exit()
type exit() for quit python
This that means successfully installed
4.Now let's type pip + ENTER
if you see multiple pip commands congratulations your good to go
5.Okay then try to install your required python library
e.g : pip install pyttsx
PS C:\Users\Rohit> pip install pyttsx3
Defaulting to user installation because normal site-packages is not writeable
Collecting pyttsx3
Using cached pyttsx3-2.90-py3-none-any.whl (39 kB)
Collecting pywin32
Using cached pywin32-302-cp310-cp310-win_amd64.whl (9.2 MB)
Collecting pypiwin32
Using cached pypiwin32-223-py3-none-any.whl (1.7 kB)
Collecting comtypes
Using cached comtypes-1.1.10.tar.gz (145 kB)
Using legacy 'setup.py install' for comtypes, since package 'wheel' is not installed.
Installing collected packages: pywin32, pypiwin32, comtypes, pyttsx3
If your see this kind of stuff, your problem is solved.
NOTE : In case it not solved go to Microsoft store and install python and launch it. Then press windows button and search for edit environment variable >> environment variable. Check if python is added to the PATH if not then add it.

Python at Synology, how to get Python3 modules installed and where is Python2.7 installed?

Can you please advise me how to get Python3 with modules running at my Synology (DS214play, with DSM 6.0.1-7393 Update 1)?
What I want: run Tweepy and other modules in Python3 on my Synology.
Where I am stuck:
how to get PIP3 to install Tweepy, if I try I get: Requirement already up-to-date: pip in /usr/lib/python2.7/site-packages
Apparently I have a Python 2.7 installed but I was not aware...
root#DiskStation:/volume1/#appstore/python3/include# ls
get-pip.py python3.4m
root#DiskStation:/volume1/#appstore/python3/include# python3 get-pip.py
-ash: python3: command not found
root#DiskStation:/volume1/#appstore/python3/include# python get-pip.py
Requirement already up-to-date: pip in /usr/lib/python2.7/site-packages
So to get PIP3 to work I need to understand where Python2.7 is installed and maybe even how to remove it (if this is necessary).
And it would be good to know which Python3 package would be best to use (default from Synology DSM package manager or the SynoCommunity Python3 pacakge)
Because I can see Python3 in the DSM package manager and in the related folders when connected with SSH (using PuTTY) to my Synology.
But I do not see any package for Python2.7 (which I believe must be there) and I cannot find any Python 2.7 folders when connected with SSH even tough I have the hint that there must be a " /usr/lib/python2.7/site-packages " folder somewhere...
-> The default Python3 from Synology DSM package manager is in a py3k folder:
admin#DiskStation: /volume1/#appstore/py3k/usr/local/bin$
python3
-> the SynoCommunity Python3 package installs in a different place:
admin#DiskStation: /volume1/#appstore/python3$ ls
bin etc include install.log lib openssl.cnf share
admin#DiskStation: /volume1/#appstore/python3/bin$ ls
2to3 busybox bzfgrep bzmore delgroup fatattr infocmp lzmainfo pip3 python3.4 reset start-stop-daemon tset virtualenv-3.4 xz
2to3-3.4 bzcat bzgrep captoinfo deluser gpg-error infotocap mpicalc pip3.4 python3.4m shuf tabs unlink wheel xzcat
addgroup bzcmp bzip2 clear dumpsexp hmac256 lzcat nice pydoc3 pyvenv speexdec tic unlzma xmlcatalog xzdec
adduser bzdiff bzip2recover c_rehash easy_install idle3 lzma openssl pydoc3.4 pyvenv-3.4 speexenc toe unxz xmllint
bunzip2 bzegrep bzless curl easy_install-3.4 idle3.4 lzmadec pip python3 renice sqlite3 tput virtualenv xsltproc
admin#DiskStation:/volume1/#appstore/python3/bin$ python3
-sh: python3: command not found
What I have done:
I installed Python3 using the Synology DSM package manager and then connected with SSH (using PuTTY) to my Synology and set the PATH and used PIP to install Tweepy and other modules.
I believe it was with some commands like: (unfortunately mostly copy pasted without knowing exactly what it means in detail...)
root#DiskStation:~# curl -k https://bootstrap.pypa.io/get-pip.py | python
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1488k 100 1488k 0 0 1577k 0 --:--:-- --:--:-- --:--:-- 1577k
Collecting pip
Using cached pip-8.1.2-py2.py3-none-any.whl
Collecting setuptools
Downloading setuptools-23.1.0-py2.py3-none-any.whl (435kB)
100% |████████████████████████████████| 440kB 551kB/s
Collecting wheel
Using cached wheel-0.29.0-py2.py3-none-any.whl
Installing collected packages: pip, setuptools, wheel
Successfully installed pip-8.1.2 setuptools-23.1.0 wheel-0.29.0
I was able to run scripts based on this and quite happy. Until I got some (Unicode) errors and from the error log saw that it is a 2.7 version of Python that runs on my Synology. It seems these Unicode issues are solved in Python3 (which I have on my PC as well) so I would like to have Python3 on Synology as well.
And the 2.7 version is indeed installed, if I connect with SSH and type Python I get:
admin#DiskStation:~$ python
Python 2.7.11 (default, May 13 2016, 05:16:12)
[GCC 4.9.3 20150311 (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
This is strange because I do not see any Python 2.7 package at Synology in the package manager so I must have installed 2.7 through some SSH command that I intended just for PIP.
I had the default Python3 package at Synology installed and if I type admin#DiskStation:~$ python3
I did get the python3 ready to work with.
Within the /volume1/#appstore/py3k/ I see all kinds of Python and PIP versions and the python3 works well. However without any modules and the PIP3 does not work ("command not found"), I tried it from all possible directories and in all kinds of formats as suggested on similar Q&As e.g. pip3.4 install tweepy, pip3 install tweepy, etc.
So now using the DSM package manager I have deinstalled Python3 and installed the SynoCommunity Python3 (as suggested on the Synology forum here) which shows a different directory structure. But seems even worse because now I see no references to Python 2.7 anymore (but still it runs so must be there) and even cannot get python3 started:
admin#DiskStation:~$ cd /volume1
admin#DiskStation:/volume1$ cd #appstore
admin#DiskStation:/volume1/#appstore$ cd python3
admin#DiskStation:/volume1/#appstore/python3$ ls
bin etc include install.log lib openssl.cnf share
admin#DiskStation:/volume1/#appstore/python3$ cd bin
admin#DiskStation:/volume1/#appstore/python3/bin$ ls
2to3 bzcmp bzless deluser idle3 lzmainfo pydoc3 renice tabs unxz xz
2to3-3.4 bzdiff bzmore dumpsexp idle3.4 mpicalc pydoc3.4 reset tic virtualenv xzcat
addgroup bzegrep captoinfo easy_install infocmp nice python3 shuf toe virtualenv-3.4 xzdec
adduser bzfgrep clear easy_install-3.4 infotocap openssl python3.4 speexdec tput wheel
bunzip2 bzgrep c_rehash fatattr lzcat pip python3.4m speexenc tset xmlcatalog
busybox bzip2 curl gpg-error lzma pip3 pyvenv sqlite3 unlink xmllint
bzcat bzip2recover delgroup hmac256 lzmadec pip3.4 pyvenv-3.4 start-stop-daemon unlzma xsltproc
admin#DiskStation:/volume1/#appstore/python3/bin$ python3
-sh: python3: command not found
admin#DiskStation:/volume1/#appstore/python3/bin$ python
Python 2.7.11 (default, May 13 2016, 05:16:12)
[GCC 4.9.3 20150311 (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
So I reached the point to ask for some tips, hints and advice.
(1)install python2.7 and python3.5 from DSM packages
(2)ssh login & sudo -i
(3)run python and run python3, if both work go next.
(4)run pip -V should return pip 10.0.1, it is for python2.7
(5)run pip3 -V return "command not found", ..because the path is not right.
(6)try /volume1/#appstore/py3k/usr/local/bin/pip3 -V,
if sucess. go next. now you can install module for python3, it's different path depends on your system, command for example: /volume1/#appstore/py3k/usr/local/bin/pip3 install numpy should be work!
(7)for convenient, shorter command is good for use,so go next step:
sudo vi .profile, (or .bashrc for specific user login)
(8)add alias at the end:
alias pip3='/volume1/#appstore/py3k/usr/local/bin/pip3'
(9)source .profile or sudo reboot
(10)test pip3 -V, should work for python3.x
Ok, many thx for the replies, I solved it with:
Confirmed that Python 2.7.9 is installed by default in Synology DSM 5.2 (and not visible in package center).
I was able to add modules to Python3 by specifically evoking the pip module installation for Python3 using this command:(thx to this Q&A)
/volume1/#appstore/py3k/usr/local/lib/python3.5/site-packages/pip install tweepy
(installing the tweepy module in this case)
And FYI the full command overview:
admin#DiskStation:/volume1/#appstore/py3k/usr/local/lib/python3.5/site-packages$ sudo -i
Password:
root#DiskStation:~# curl -O https://bootstrap.pypa.io/get-pip.py
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1488k 100 1488k 0 0 1704k 0 --:--:-- --:--:-- --:--:-- 1703k
root#DiskStation:~# sudo python3 get-pip.py
Requirement already up-to-date: pip in /volume1/#appstore/py3k/usr/local/lib/python3.5/site-packages
root#DiskStation:~# pip install tweepy
Requirement already satisfied (use --upgrade to upgrade): tweepy in /usr/lib/python2.7/site-packages
Requirement already satisfied (use --upgrade to upgrade): six>=1.7.3 in /usr/lib/python2.7/site-packages (from tweepy)
Requirement already satisfied (use --upgrade to upgrade): requests>=2.4.3 in /usr/lib/python2.7/site-packages (from tweepy)
Requirement already satisfied (use --upgrade to upgrade): requests-oauthlib>=0.4.1 in /usr/lib/python2.7/site-packages (from tweepy)
Requirement already satisfied (use --upgrade to upgrade): oauthlib>=0.6.2 in /usr/lib/python2.7/site-packages (from requests-oauthlib>=0.4.1->tweepy)
root#DiskStation:~# python3 ^C
root#DiskStation:~# python3 /volume1/#appstore/py3k/usr/local/lib/python3.5/site-packages/pip install tweepy
Collecting tweepy
Using cached tweepy-3.5.0-py2.py3-none-any.whl
Collecting requests-oauthlib>=0.4.1 (from tweepy)
Using cached requests_oauthlib-0.6.1-py2.py3-none-any.whl
Collecting requests>=2.4.3 (from tweepy)
Using cached requests-2.10.0-py2.py3-none-any.whl
Collecting six>=1.7.3 (from tweepy)
Using cached six-1.10.0-py2.py3-none-any.whl
Collecting oauthlib>=0.6.2 (from requests-oauthlib>=0.4.1->tweepy)
Using cached oauthlib-1.1.2.tar.gz
Building wheels for collected packages: oauthlib
Running setup.py bdist_wheel for oauthlib ... done
Stored in directory: /root/.cache/pip/wheels/e6/be/43/e4a2ca8cb9c78fbd9b5b14b96cb7a5cc43f36bc11af5dfac5b
Successfully built oauthlib
Installing collected packages: requests, oauthlib, requests-oauthlib, six, tweepy
Successfully installed oauthlib-1.1.2 requests-2.10.0 requests-oauthlib-0.6.1 six-1.10.0 tweepy-3.5.0
(And I uninstalled the SynoCommunity Python3 package again and now use the DSM package center Python3 version)
I'm not sure you can remove Python 2 altogether, but you can install Python 3 and evoke it specifically instead of Python 2.
First, make sure Python 3 is Installed:
Log into your Synology via the web administration and in the 'Package Center' make sure 'Python 3' is installed. (You will find it under 'Developer Tools' within the 'Package Center')
Next, specifically evoke Python 3 by simply calling python3
You could also try using the locate command on your Synology to find the exact location of Python 2. To do this enter the following on your Synology:
ipkg update
ipkg install mlocate
And here is a tutorial on how to use the command: http://www.thegeekstuff.com/2012/03/locate-command-examples/
Good luck!
Also,
If you don't have luck on Stack Overflow I'd run over to the Synology Forums for help as well: https://forum.synology.com

How to get Python packages installed as .exe to run on Windows 10; "failed to create process"

After installing Python 3.5.1 on Windows 10 x64, cpplint installed from pip produces the error: failed to create process. There seems to be a possibly related issue with pip related to having a space in the path, which exists in my use case. It seems to be related to how the exe is created. How can this error be remedied? Reinstalling Python and cpplint does not solve the problem.
C:\Users>python -V
Python 3.5.1
C:\Users>pip list
pip (7.1.2)
setuptools (18.2)
C:\Users>pip -V
pip 7.1.2 from c:\users\john hagen\appdata\local\programs\python\python35\lib\site-packages (python 3.5)
C:\Users>pip install cpplint
Collecting cpplint
Using cached cpplint-0.0.6.tar.gz
Installing collected packages: cpplint
Running setup.py install for cpplint
Successfully installed cpplint-0.0.6
C:\Users>where.exe cpplint
C:\Users\John Hagen\AppData\Local\Programs\Python\Python35\Scripts\cpplint.exe
C:\Users>cpplint
failed to create process.
Yep, this is a pip bug.
The workaround is to add quotes around the path in the first line of generated python scripts in the \Scripts\ directory. In the case of cpplint this is 'cpplint-script.py'. In your case the generated first line should something like:
#!c:\users\john hagen\appdata\local\programs\python\python35\python.exe
and should be edited to:
#!"c:\users\john hagen\appdata\local\programs\python\python35\python.exe"

Categories