Python: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 133: Line 133:


<!--T:30-->
<!--T:30-->
To see where the <tt>pip</tt> command is installing a python package from, diagnosing installation issues, you can tell it to be more verbose with the <tt>-vvv</tt> option. It also worth mentioning that when installing multiple packages it is advisable to install them with one command as it helps pip resolve dependencies.
To see where the <code>pip</code> command is installing a python package from, diagnosing installation issues, you can tell it to be more verbose with the <code>-vvv</code> option. It also worth mentioning that when installing multiple packages it is advisable to install them with one command as it helps pip resolve dependencies.


==== Installing dependent packages ==== <!--T:35-->
==== Installing dependent packages ==== <!--T:35-->


<!--T:65-->
<!--T:65-->
In some cases, such as TensorFlow, we provide wheels for a specific host (cpu or gpu), suffixed with <tt>_cpu</tt> or <tt>_gpu</tt>. Packages dependent on <tt>tensorflow</tt> will then fail to install.  
In some cases, such as TensorFlow, we provide wheels for a specific host (cpu or gpu), suffixed with <code>_cpu</code> or <code>_gpu</code>. Packages dependent on <code>tensorflow</code> will then fail to install.  
If <tt>my_package</tt> depend on <tt>numpy</tt> and <tt>tensorflow</tt>, then the following will allow us to install it:
If <code>my_package</code> depend on <code>numpy</code> and <code>tensorflow</code>, then the following will allow us to install it:
{{Commands|prompt=(ENV) [name@server ~]
{{Commands|prompt=(ENV) [name@server ~]
|pip install numpy tensorflow_cpu --no-index
|pip install numpy tensorflow_cpu --no-index
|pip install my_package --no-deps
|pip install my_package --no-deps
}}
}}
The <tt>--no-deps</tt> options tells <tt>pip</tt> to ignore dependencies.
The <code>--no-deps</code> options tells <code>pip</code> to ignore dependencies.


=== Creating virtual environments inside of your jobs === <!--T:36-->
=== Creating virtual environments inside of your jobs === <!--T:36-->
rsnt_translations
56,420

edits

Navigation menu