mirror of
https://github.com/clearml/clearml-agent
synced 2025-03-13 15:08:44 +00:00
Fix support for Windows pip and Conda requirements.txt
This commit is contained in:
parent
72efe2e9fe
commit
428781af86
@ -67,7 +67,7 @@ class PackageManager(object):
|
|||||||
|
|
||||||
def upgrade_pip(self):
|
def upgrade_pip(self):
|
||||||
result = self._install(
|
result = self._install(
|
||||||
select_for_platform(windows='"pip{}"', linux='pip{}').format(self.get_pip_version()), "--upgrade")
|
select_for_platform(windows='pip{}', linux='pip{}').format(self.get_pip_version()), "--upgrade")
|
||||||
packages = self.run_with_env(('list',), output=True).splitlines()
|
packages = self.run_with_env(('list',), output=True).splitlines()
|
||||||
# p.split is ('pip', 'x.y.z')
|
# p.split is ('pip', 'x.y.z')
|
||||||
pip = [p.split() for p in packages if len(p.split()) == 2 and p.split()[0] == 'pip']
|
pip = [p.split() for p in packages if len(p.split()) == 2 and p.split()[0] == 'pip']
|
||||||
|
@ -132,7 +132,7 @@ class CondaAPI(PackageManager):
|
|||||||
if self.env_read_only:
|
if self.env_read_only:
|
||||||
print('Conda environment in read-only mode, skipping pip upgrade.')
|
print('Conda environment in read-only mode, skipping pip upgrade.')
|
||||||
return ''
|
return ''
|
||||||
return self._install(select_for_platform(windows='"pip{}"', linux='pip{}').format(self.pip.get_pip_version()))
|
return self._install(select_for_platform(windows='pip{}', linux='pip{}').format(self.pip.get_pip_version()))
|
||||||
|
|
||||||
def create(self):
|
def create(self):
|
||||||
"""
|
"""
|
||||||
@ -284,17 +284,11 @@ class CondaAPI(PackageManager):
|
|||||||
"""
|
"""
|
||||||
Try to install packages from conda. Install packages which are not available from conda with pip.
|
Try to install packages from conda. Install packages which are not available from conda with pip.
|
||||||
"""
|
"""
|
||||||
try:
|
requirements = {}
|
||||||
self._install_from_file(path)
|
# assume requirements.txt
|
||||||
return
|
with open(path, 'rt') as f:
|
||||||
except PackageNotFoundError as e:
|
requirements['pip'] = f.read()
|
||||||
pip_packages = [e.pkg]
|
self.load_requirements(requirements)
|
||||||
except PackagesNotFoundError as e:
|
|
||||||
pip_packages = package_set(e.packages)
|
|
||||||
with self.temp_file("conda_reqs", _package_diff(path, pip_packages)) as reqs:
|
|
||||||
self.install_from_file(reqs)
|
|
||||||
with self.temp_file("pip_reqs", pip_packages) as reqs:
|
|
||||||
self.pip.install_from_file(reqs)
|
|
||||||
|
|
||||||
def freeze(self, freeze_full_environment=False):
|
def freeze(self, freeze_full_environment=False):
|
||||||
requirements = self.pip.freeze()
|
requirements = self.pip.freeze()
|
||||||
|
Loading…
Reference in New Issue
Block a user