简体   繁体   中英

Anaconda pip offline installation including dependencies (tensorflow)

I want to install tensorflow in an anaconda environment on a system without internet connection, and where I have not got root access (ie I want to install it to my local user only)

I have downloaded the .whl files of tensorflow and the required dependencies and copied them to the machine I want to use. Once I've entered my anaconda environment I started installing the packages using

pip install -b working_directory/build -t working_directory/target package.whl

But when I want to install a package which depends on an earlier installed package, it cannot find it.

So I wonder, how can you tell pip where to look for dependencies? Can I install tensorflow in an easier way, still offline and without root?

I am using PyCharm for the development with anaconda. I was also facing issue while installing tensorflow using conda, I also installed the python 3.6 and used the steps given on the tensorflow website. But finally I solved this using below steps and made it work on pyCharm:

Step 1: I downloaded binaries (.whl) file of tensorflow (The links of binaries are given on the git page https://github.com/tensorflow/tensorflow )

Step 2: Then I installed the tensorflow offline using below command:

pip.exe install --upgrade --no-deps C:\Important_Software\tensorflow-1.3.0rc0-cp36-cp36m-win_amd64.whl

Step 3: Then Tensorflow files have been created at below location:

C:\Program Files\Python36\Lib\site-packages

I copied these files and pasted in the Anaconda site-packages (Anaconda3\\Lib\\site-packages).

Step 4: Tensorflow is installed but below error has come when running the basic program:

  File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\core\framework\graph_pb2.py", line 6, in <module>
    from google.protobuf import descriptor as _descriptor
ModuleNotFoundError: No module named 'google'

Step 5: I have solved this error using pip installation of protocol buffer

pip.exe install --upgrade --no-deps "C:\TarFile_location\protobuf-3.3.0.tar.gz"

Step 6: After this 3 files “protobuf-3.3.0-py3.6-nspkg.pth”, “protobuf-3.3.0-py3.6.egg-info” and “google” are created at the below location:

C:\Program Files\Python36\Lib\site-packages

These three file should be pasted at the Anaconda site-packages. (Anaconda3\\Lib\\site-packages)

Step 6: The I ran the below program and It worked:

  import tensorflow as tf
  hello = tf.constant('Hello, TensorFlow!')
  sess = tf.Session()
  print(sess.run(hello))

If there will be still some Errors then all dependencies have to be downloaded and installed similar as step 2 or 5 from https://pypi.python.org/pypi/tensorflow . Important note: I was using the Windows command prompt with admin Access.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM