Let me begin by saying I am very new to python so I will try to be as concise as possible, but please read my question with that thought in mind and have mercy on my ignorant soul.
I am working with an application, written in C++, that ships with Python version 3.4. The software allows users to write Python scripts and save them to a directory in order to control the program through these custom scripts. However, the Python library that ships with the software doesn't include matplotlib. Is it possible to use the pip installer to install matplotlib in this program's Python directory? I tried using --target with the pip installer, but that has not worked for me. If I cannot use pip, can anyone direct me to some documentation that might help me understand how to add packages to Python shipped within another program?
Furthermore, for future reference, is it possible to upgrade the version of Python within this program to Python 3.7 without access to the program's C++ source code?
Thank you for any input and help, and for not spitefully bashing my poorly posited question.
Edit:
Running path\to\python.exe -m site yielded the following:
C:\>"C:\path\python34\python.exe" -m site
sys.path = [
'C:\\',
'C:\\path\\python34\\python34.zip',
'C:\\path\\DLLs',
'C:\\path\\lib',
'C:\\path\\python34',
'C:\\path\\python34\\lib\\site-packages',
]
USER_BASE: 'C:\\Users\\user\\AppData\\Roaming\\Python' (exists)
USER_SITE: 'C:\\Users\\user\\AppData\\Roaming\\Python\\Python34\\site-packages' (doesn't exist)
ENABLE_USER_SITE: True
Running the command "path\python34\python" "path\pip-20.0.2-py2.py3-none-any.whl\pip" install -U -I pip yields the following output and subsequent error:
Traceback (most recent call last):
File "C:\path\python34\lib\runpy.py", line 170, in _run_module_as_main
"__main__", mod_spec)
File "C:\path\python34\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\path\pip-20.0.2-py2.py3-none-any.whl\pip\__main__.py", line 16, in <module>
File "C:\path\pip-20.0.2-py2.py3-none-any.whl\pip\_internal\cli\main.py", line 10, in <module>
File "C:\path\pip-20.0.2-py2.py3-none-any.whl\pip\_internal\cli\autocompletion.py", line 9, in <module>
File "C:\path\pip-20.0.2-py2.py3-none-any.whl\pip\_internal\cli\main_parser.py", line 7, in <module>
File "C:\path\pip-20.0.2-py2.py3-none-any.whl\pip\_internal\cli\cmdoptions.py", line 28, in <module>
File "C:\path\pip-20.0.2-py2.py3-none-any.whl\pip\_internal\models\target_python.py", line 4, in <module>
File "C:\path\pip-20.0.2-py2.py3-none-any.whl\pip\_internal\utils\misc.py", line 20, in <module>
File "C:\path\pip-20.0.2-py2.py3-none-any.whl\pip\_vendor\pkg_resources\__init__.py", line 35, in <module>
File "C:\path\python34\lib\plistlib.py", line 65, in <module>
from xml.parsers.expat import ParserCreate
File "C:\path\python34\lib\xml\parsers\expat.py", line 4, in <module>
from pyexpat import *
ImportError: DLL load failed: The specified procedure could not be found.
Related
I need to install an older version of DVC, namely 0.9.4, in a Python virtual environment.
I used the command:
pip install dvc==0.9.4
Everything seemed to work fine. However, when I try to run a dvc pull command, I get the following error:
Traceback (most recent call last):
File "c:\users\lbrandao\anaconda3\envs\my_env\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\users\lbrandao\anaconda3\envs\my_env\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\lbrandao\anaconda3\envs\my_env\Scripts\dvc.exe\__main__.py", line 4, in <module>
File "c:\users\lbrandao\anaconda3\envs\my_env\lib\site-packages\dvc\main.py", line 2, in <module>
from dvc.cli import parse_args
File "c:\users\lbrandao\anaconda3\envs\my_env\lib\site-packages\dvc\cli.py", line 8, in <module>
from dvc.command.init import CmdInit
File "c:\users\lbrandao\anaconda3\envs\my_env\lib\site-packages\dvc\command\init.py", line 1, in <module>
from dvc.project import Project
File "c:\users\lbrandao\anaconda3\envs\my_env\lib\site-packages\dvc\project.py", line 15, in <module>
from dvc.cloud.data_cloud import DataCloud
File "c:\users\lbrandao\anaconda3\envs\my_env\lib\site-packages\dvc\cloud\data_cloud.py", line 11, in <module>
from dvc.cloud.gcp import DataCloudGCP
File "c:\users\lbrandao\anaconda3\envs\my_env\lib\site-packages\dvc\cloud\gcp.py", line 4, in <module>
from google.cloud import storage as gc
ModuleNotFoundError: No module named 'google.cloud'
When I print the dvc version, I see:
0.9.4+6bb66e.mod
Can anyone please help? Thanks.
Assuming the remote storage is on Google Cloud based on that error, you may need to install the special dvc[gs] module instead, e.g.:
pip install dvc[gs]==0.9.4
See https://dvc.org/doc/install/linux#install-with-pip
BTW DVC 1.x should be backward compatible with DVC 0.9 in case you want to try a newer version.
Also, try to migrate your project to DVC 2.x (latest as of now), here are some guidelines: https://dvc.org/blog/dvc-2-0-release#breaking-changes
I was able to overcome the previous issue with:
pip install --upgrade google-cloud-storage
When I try to install any module for python using command prompt or PowerShell, then there is a message that shows up, the message is:
File "c:\users\opkp\app data\local\programs\python\python38-32\lib\runpy.py", line 193, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\users\opkp\appdata\local\programs\python\python38-32\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Users\OPKP\AppData\Local\Programs\Python\Python38-32\Scripts\pip.exe\__main__.py", line 5, in <module>
File "c:\users\opkp\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\__init__.py", line 19, in <module>
from pip._vendor.urllib3.exceptions import DependencyWarning
File "c:\users\opkp\appdata\local\programs\python\python38-32\lib\site-packages\pip\_vendor\urllib3\__init__.py", line 7, in <module>
from .connectionpool import (
File "c:\users\opkp\appdata\local\programs\python\python38-32\lib\site-packages\pip\_vendor\urllib3\connectionpool.py", line 11, in <module>
from .exceptions import (
ModuleNotFoundError: No module named 'pip._vendor.urllib3.exceptions'
I know it has the names of my drivers and all. Due to this, I am not able to download any module for python.
Things that I have tried and that failed me:
I Googled it
YouTube videos were not tackling my problem, what they were telling me is just how to install pip (which I already have) and how to add the path (which I have already done)
Commands that gave this error:
pip install flask
py -m ( I don't remember it fully but i wrote it correctly )
pip3 install flask
and i have also uninstalled and installed python
etc.
Here is my error message in the command prompt:
I also tried that py -m statement but that also gave the same result.
You can try to re-install pip or even completely re-install Python.
I have Linux Mint 17 and Python 3.4.0. I had downloaded python3.4 package for utopic so I can get Python 3.4.2. I downloaded its dependencies as well as IDLE and python3-tk for 3.4.2. After install, I did not find anything of my liking. So, with the help of Synaptic, I downgraded the packages back to the original 3.4.0 packages. I experienced no problem until I had a problem in a program I was making for time-pass. I tried to debug my app in PyCharm could no longer debug my apps in PyCharm. In the Console section, this error came up:-
/usr/bin/python3.4 /opt/pycharm-community-3.4.1/helpers/pydev/pydevd.py --multiproc --client 127.0.0.1 --port 37770 --file "/home/ibrahim/Documents/Python/Team Rocket.py"
Traceback (most recent call last):
File "/opt/pycharm-community-3.4.1/helpers/pydev/pydevd.py", line 4, in <module>
from django_debug import DjangoLineBreakpoint
File "/opt/pycharm-community-3.4.1/helpers/pydev/django_debug.py", line 2, in <module>
from django_frame import DjangoTemplateFrame, get_template_file_name, get_template_line
File "/opt/pycharm-community-3.4.1/helpers/pydev/django_frame.py", line 1, in <module>
from pydevd_file_utils import GetFileNameAndBaseFromFile
File "/opt/pycharm-community-3.4.1/helpers/pydev/pydevd_file_utils.py", line 44, in <module>
from pydevd_constants import * ##UnusedWildImport
File "/opt/pycharm-community-3.4.1/helpers/pydev/pydevd_constants.py", line 80, in <module>
import threading
ImportError: No module named 'threading'
Process finished with exit code 1
Then I opened IDLE to debug my program to get at least some information from its underpowered debugger and neither did it work! So I started it directly by python3 -m idlelib.idle and it gave me the same error (but different references). Here is the error.
Traceback (most recent call last):
File "/usr/lib/python3.4/runpy.py", line 170, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.4/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/lib/python3.4/idlelib/idle.py", line 10, in <module>
import idlelib.PyShell
File "/usr/lib/python3.4/idlelib/PyShell.py", line 10, in <module>
import threading
ImportError: No module named 'threading'
I think including the program code is trivial but if you want it then I can give it to you. I have just confirmed I have downgraded all packages.
Version numbers for Python:-
python3.4 = 3.4.0-2ubuntu1
python3.4-minimal = 3.4.0-2ubuntu1
python3-tk = 3.4.0-0ubuntu1
idle-python3.4 = 3.4.0-2ubuntu1
PyCharm Community Edition = 3.4.1; Build = 135.1057; Running on Oracle Java 1.8.0 aka Java 8 for amd64 systems. Not running on OpenJDK.
I installed twill by using pip, and another try using easy_install, I want to play around with it in Powershell. Following this page - http://twill.idyll.org/ I wanted to play around with it.
To start using twill, install it and then type twill-sh. At the prompt type:
go http://www.slashdot.org/
show
showforms
showhistory
When I type twill-sh it doesn't work. I have typed it in power shell, tried it after loading python, and tried it after using import twill and trying it. I only get errors.
Traceback (most recent call last):
File "C:\Python27\Scripts\twill-sh-script.py", line 9, in <module>
load_entry_point('twill==1.8.0', 'console_scripts', 'twill-sh')()
File "build\bdist.win32\egg\pkg_resources.py", line 356, in load_entry_point
File "build\bdist.win32\egg\pkg_resources.py", line 2439, in load_entry_point
File "build\bdist.win32\egg\pkg_resources.py", line 2155, in load
File "C:\Python27\lib\site-packages\twill\__init__.py", line 52, in <module>
from shell import TwillCommandLoop
File "C:\Python27\lib\site-packages\twill\shell.py", line 9, in <module>
from twill import commands, parse, __version__
File "C:\Python27\lib\site-packages\twill\commands.py", line 7, in <module>
from lxml import html
How do I just load modules so I can play with them without writing scripts?
I had the same problem. Further down the log I found the following:
File "C:\Anaconda\lib\site-packages\lxml\cssselect.py", line 18, in <module> raise ImportError('cssselect seems not to be installed. '
ImportError: cssselect seems not to be installed. See http://packages.python.org/cssselect/
Which I fixed by installing package cssselect (using conda as I have an Anaconda installation, pip should do the same).
conda install cssselect
I want to use pyOpenSSL, which I have downloaded and tried to build, but I am having problems with setuptools.
First I have downloaded just python and used it with no success, but now I have tried with WinPython and got the same result, which is:
Traceback (most recent call last):
File "setup.py", line 11, in <module>
from setuptools import setup
File "C:\Users\User\Downloads\WinPython-32bit-2.7.6.3\python-2.7.6\lib\site-packages\setuptools\__init_
_.py", line 11, in <module>
from setuptools.extension import Extension
File "C:\Users\User\Downloads\WinPython-32bit-2.7.6.3\python-2.7.6\lib\site-packages\setuptools\extensi
on.py", line 5, in <module>
from setuptools.dist import _get_unpatched
File "C:\Users\User\Downloads\WinPython-32bit-2.7.6.3\python-2.7.6\lib\site-packages\setuptools\dist.py
", line 15, in <module>
from setuptools.compat import numeric_types, basestring
File "C:\Users\User\Downloads\WinPython-32bit-2.7.6.3\python-2.7.6\lib\site-packages\setuptools\compat.
py", line 19, in <module>
from SimpleHTTPServer import SimpleHTTPRequestHandler
File "C:\Users\User\Downloads\WinPython-32bit-2.7.6.3\python-2.7.6\lib\SimpleHTTPServer.py", line 27, i
n <module>
class SimpleHTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
File "C:\Users\User\Downloads\WinPython-32bit-2.7.6.3\python-2.7.6\lib\SimpleHTTPServer.py", line 208,
in SimpleHTTPRequestHandler
mimetypes.init() # try to read system mime.types
File "C:\Users\User\Downloads\WinPython-32bit-2.7.6.3\python-2.7.6\lib\mimetypes.py", line 358, in init
db.read_windows_registry()
File "C:\Users\User\Downloads\WinPython-32bit-2.7.6.3\python-2.7.6\lib\mimetypes.py", line 260, in read
_windows_registry
with _winreg.OpenKey(hkcr, subkeyname) as subkey:
TypeError: must be string without null bytes or None, not str
I have installed Python 2.7.6 with PyCharm with no success, and also tried WinPython with the same result.
I am running windows 7 x64.
Since you are facing problem in installing setuptools itself, you can download the windows binary file for setuptools from this link.
This website is a great repository of pre-compiled windows binaries for various Python modules.
If installing 64-bit Python is not a necessity, I would suggest you to install 32-bit version of Python and other modules.
This is related to a bug in Python 2.7.6, to do with Windows Registry corruption.
Some programs (wrongly) write a terminating null to registry entries and this screws up setuptools. Updating Python fixes the issue.
See This blog post