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
Related
I am new to python, and I found a matlab code online that I want to convert to python code using smop.
I've installed smop, however when I try to run it I get an error.
When I have networkx version 1.11 I get the following error trying to run smop main.m
Traceback (most recent call last):
File "C:\Users\IDABUK\Anaconda3\envs\smop\lib\site-packages\smop\main.py", line 66, in main
G = resolve.resolve(stmt_list)
File "C:\Users\IDABUK\Anaconda3\envs\smop\lib\site-packages\smop\resolve.py", line 54, in resolve
u = G.node[n]["ident"]
AttributeError: 'DiGraph' object has no attribute 'node'
Errors: 1
When I install a later version of networkx (pip install networkx==2.0 or pip install networkx==2.5) I get the following error:
Traceback (most recent call last):
File "C:\Users\IDABUK\Anaconda3\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\IDABUK\Anaconda3\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Users\IDABUK\Anaconda3\Scripts\smop.exe\__main__.py", line 4, in <module>
File "C:\Users\IDABUK\Anaconda3\lib\site-packages\smop\main.py", line 17, in <module>
from . import resolve
File "C:\Users\IDABUK\Anaconda3\lib\site-packages\smop\resolve.py", line 22, in <module>
import networkx as nx
File "C:\Users\IDABUK\Anaconda3\lib\site-packages\networkx\__init__.py", line 114, in <module>
import networkx.generators
File "C:\Users\IDABUK\Anaconda3\lib\site-packages\networkx\generators\__init__.py", line 6, in <module>
from networkx.generators.classic import *
File "C:\Users\IDABUK\Anaconda3\lib\site-packages\networkx\generators\classic.py", line 26, in <module>
from networkx.algorithms.bipartite.generators import complete_bipartite_graph
File "C:\Users\IDABUK\Anaconda3\lib\site-packages\networkx\algorithms\__init__.py", line 16, in <module>
from networkx.algorithms.dag import *
File "C:\Users\IDABUK\Anaconda3\lib\site-packages\networkx\algorithms\dag.py", line 14, in <module>
from fractions import gcd
ImportError: cannot import name 'gcd' from 'fractions' (C:\Users\IDABUK\Anaconda3\lib\fractions.py)
I am running this from the anaconda prompt window (anaconda power shell?).
Is there a way to fix this?
The only solutions I find online are people installing various networkx-versions which does not seem like a solution for me in this case, or changing 'node' to 'nodes' directly in the code, however I can't find any instances of 'nodes' in the matlab code.
For people in the future looking for an answer:
I could not find an answer for this.
However it worked using matlab2python.
This is how it worked for me:
In the terminal I wrote
git clone https://github.com/ebranlard/matlab2python
cd matlab2python
pip install -r requirements.txt
and then I used this code to convert each matlab-script:
python matlab2python/matlab2python.py file.m -o file.py
Whenever I try to use pip, using any command I get this:
Traceback (most recent call last):
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1008.0_x64__qzc5n2dfsdra8p0\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1008.0_x64__qzc5n2dfsd8p0\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Users\SE\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_q3.8_qzc5n2dfsd8p0\LocalCache\local-packages\Python38\site-packages\pip\__main__.py", line 23, in <module>
from pip._internal.cli.main import main as _main # isort:skip # noqa
File "C:\Users\SE\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qzc5n2dfsd8p0\LocalCache\local-packages\Python38\site-packages\pip\_internal\cli\main.py", line 10, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "C:\Users\SE\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qzc5n2dfsd8p0\LocalCache\local-packages\Python38\site-packages\pip\_internal\cli\autocompletion.py", line 9, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "C:\Users\SE\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qzc5n2dfsd8p0\LocalCache\local-packages\Python38\site-packages\pip\_internal\cli\main_parser.py", line 7, in <module>
from pip._internal.cli import cmdoptions
File "C:\Users\SE\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qzc5n2dfsd8p0\LocalCache\local-packages\Python38\site-packages\pip\_internal\cli\cmdoptions.py", line 24, in <module>
from pip._internal.cli.progress_bars import BAR_TYPES
File "C:\Users\SE\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qzc5n2dfsd8p0\LocalCache\local-packages\Python38\site-packages\pip\_internal\cli\progress_bars.py", line 8, in <module>
from pip._vendor.progress.bar import Bar, FillingCirclesBar, IncrementalBar
ModuleNotFoundError: No module named 'pip._vendor.progress'
PS C:\Users\SE> No module named 'pip._vendor.progress'No module named 'pip._vendor.progress'
I am on Windows 10, 64 bit, Python version 3.7.7.
I cannot use pip, how can I fix it?
If pip is broken after an attempted upgrade to a newer version, try the following:
Download get-pip.py and "Save As" the file using right-click.
Open a command prompt as an administrator
cd to the path where you saved the file, in my case
cd C:\Users\xyz\Downloads> then type python get-pip.py. It will install all required packages, such as wheel and pip.
To check if it installed correctly, type pip --version in the command line.
Hope my answer helps someone. Happy coding. 🙂
Try doing python -m pip install pytest. This should install it, and it will make it usable by your IDE.
Hope this helps!
You could follow the equivalent steps mentioned here and here (Both are closed issues on pip's github page) on your windows machine.
On windows you can do this:
python -m pip uninstall pip setuptools # Sometimes setuptools might be the problem
This will uninstall pip and setuptools.
After which you can reinstall them using
python -m ensurepip
This will install pip and setuptools.
I have tried this on my windows 10 machine running Python 3.7.4!
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.
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.
I have read many of the questions and answers regarding "IncompleteRead" most, if not all, of them end up with a recommendation to uninstall and reinstall pip, or upgrade pip, or uninstall and reinstall the package you are trying to install.
I am not able to even upgrade pip or uninstall it.
Here is the traceback:
c:\Python27>python.exe -m pip install -U pip
Traceback (most recent call last):
File "c:\Python27\lib\runpy.py", line 174, in _run_module_as_main "__main__", fname, loader, pkg_name)
File "c:\Python27\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "c:\Python27\lib\site-packages\pip\__main__.py", line 16, in <module>
from pip._internal import main as _main # isort:skip # noqa
File "c:\Python27\lib\site-packages\pip\_internal\__init__.py", line 19, in <module>
from pip._vendor.urllib3.exceptions import DependencyWarning
File "c:\Python27\lib\site-packages\pip\_vendor\urllib3\__init__.py", line 8, in <module>
from .connectionpool import (
File "c:\Python27\lib\site-packages\pip\_vendor\urllib3\connectionpool.py", line 11, in <module>
from .exceptions import (
File "c:\Python27\lib\site-packages\pip\_vendor\urllib3\exceptions.py", line 2, in <module>
from .packages.six.moves.http_client import (
ImportError: cannot import name IncompleteRead
Any suggestions?
You can try and remove requests module first dist-packages
rm -rf python2.7/dist-packages/requests*
pip module need requests module to download packages from Python Package Index.
Hope this might help
I suggest you download the package yourself from here or find it yourself, and then try pip install urllib3-1.25.7-py2.py3-none-any.whl (replace the filename with the wheel you download). This way, you can reinstall urllib3 without importing it first.