Tensorflow installation issues - python

System information
OS Platform and Distribution - Windows 10
TensorFlow version: latest
Python version: 3.6.4
Installed using virtualenv? pip? conda?: - virtualenv
Greetings,
I hope this is the correct place to submit an inquiry of this nature, if it is not, please forgive my confusion & please point me in the right direction. I greatly appreciate your time & consideration.
I am new to Python & Tensorflow. I've done some coding with C in the past, mostly when I was in college. I am determined to learn Python & to utilize both Python & Tensorflow for AI & Machine Learning purposes.
I've had difficulties in getting Tensorflow to install properly. I started by installing the latest version of Python which didn't seem to like my attempts at installing Tensorflow, I then went with Python 3.6.4-amd64. I installed that, created a fresh directory for my environments, then installed pip & virtual env, then created a virtual environment to setup with Tensorflow.
One of the confusing issues I keep encountering is that when I install pip & virtualenv, and eventually Tensorflow, it keeps sending it by default to C:\user\username\appdata\roaming\python etc, my question is, how do I prevent it from doing that? I am trying to install in the direct being utilized in the command prop, I call up the fresh directory I created for my virtual environment, then activate the virtual environment, and no matter what I do it keeps sending all new install files into the appdata/roaming user directory sub folders.
This is causing the incredibly annoying issue of making it impossible for me to proceed with utilizing Tensorflow because I get nothing but errors on missing files, path directory etc etc. I even tried manually moving some of the files over to the virtual environment directory and that worked in some cases, but did not solve the overall problem.
Okay, now that I've made it painfully apparent how much of an uneducated newbie I am with all of this, may someone please give me some advice. The first step is admitting you need help, and I clearly do as I've spent several hours with my eyes glued to various articles and tutorials that have left me with more questions than answers. I truly appreciate any help you're willing to provide. Just a loner trying to figure this all out & increase my knowledge along the way. Thanks for your time,

Just moving the folder is not enough.
Once you have moved it, you must replace the original with a symbolic link to the new location. This will make windows think the data is still located on your C drive, while it actually is on your D drive.
Do note, this does work with AppData, but not with Program Files nor with the Windows folder, as it will break things like Windows Update.
To create the Directory Junction (Symbolic Link) do the following:
Open a cmd window with administrative privileges.
Navigate to c:\Users\username\appdata
execute the following command: mklink /d local d:\appdata\local
replace d:\appdata\local with the actual path of where you moved the appdata to.
If you cannot move/delete the original copy, create a 2nd user, make it administrator, login with it, and retry the option. This should ensure that no files are in use.
With the above issue fixed, follow the tensorflow installation steps in Anaconda provided here.
Hope this answers your question. Happy Learning.

Related

I must install django for every single project i make?

i am new to Python programming language and Django. I am learning about web development with Django, however, each time I create a new project in PyCharm, it doesn´t recognize django module, so i have to install it again. Is this normal? Because i´ve installed django like 5 times. It doesn´t seem correct to me, there must be a way to install Django once and for all and not have the necessity of using 'pip install django' for each new project I create, I am sure there must be a way but I totally ignore it, I think I have to add django to path but I really don´t know how (just guessing). I will be thankful if anyone can help me :)
pycharm runs in a venv. A venv is an isolated duplicate (sort of) of python (interpreter) and other scripts. To use your main interpreter, change your interpreter location. The three folders (where your projects is, along with your other files) are just that. I think there is an option to inherit packages. I like to create a file called requirements.txt and put all my modules there. Comment for further help.
In conclusion, this is normal.
There are 2 ways of starting your project in PyCharm.
To use a virtual environment where you have to install the external libraries into this environment.
To start using the existing interpreter. (If you chose this option you don't have to install it again installing it only once globally would be enough)
So when you start to create a new project choose the existing interpreter.
Doing this will not require you to install it every time(But is not recommended for big projects as there would dependencies on different versions of libraries).

Issue with existing system Python and installing Anaconda for a new Python - new to programming

As someone who is just getting started with programming and installing Python, I am looking for an answer to an installation question that hopefully doesn't involve much coding itself. This is the bottleneck that is keeping me from utilizing Python and downloading spyder, pandas etc. that I need to learn for work.
In trying to install Anaconda on my Windows PC, I am getting an error
enter image description here. Basically, it says that if I want Anaconda registered as my system Python, that I unregister this earlier Python first. This earlier Python was installed as a default part of the Pymol program installation package, which I use for structural analysis.
Based on reading the one question that has asked this on stack exchange in the past, it sounds like this means that python has already been integrated on my Windows and now when I try to code, the system will need to figure out whether I would like to do so in the Anaconda environment or with the non-anaconda Python. My questions are a) how do I unregister this other python? b) should I just uninstall the whole Pymol program (and with it, the python)? c) If I say "ok" to this prompt and download Anaconda, will this cause problems with my existing Python installation or will it not matter in the end?
I also tried emailing Anaconda support a few times before realizing that they don't provide individual support unless you're an enterprise user.
Would appreciate any and all advice on this issue so I can move forward. Thanks very much.
You don't need to unregister your previous PYTHON installation. Edit your SYSTEM PATH should fix this. In case your anaconda is before your other python installation, or remove your older Python for it at all. How to set your PATH ?, check hier:

how install caffe for all system users?

I installed caffe with anaconda in my home directory and it works.
Now I want that also the other system users can use caffe and run it using the python wrapper.
Thus, I first installed anaconda in /opt/anaconda and added this folder in the PATH variable in /etc/bash.bashrc (in a similar way I did with my .bashrc file). Then I copied my caffe directory to /opt/caffe and added the proper path in the PYTHONPATH variable in /etc/bash.bashrc.
As result, if another user runs python he correctly uses the anaconda version. Moreover he can run import caffe, but when it does so, an error is obtained because the python wrapper doesn t find the protobuf library.
I though that all the requirements have been installed for all the users and not just for me.
How can I correctly permit other users to run caffe using the copy in /opt/caffe?
Thanks in advance
This is an answer for those who've compiled Caffe up to make distribute and went for extra style points with make pycaffe. I am proud of you. Now you would like to let all users of your Debian-based OS import caffe from Python successfully (e.g. avoiding the cannot find libcaffe.so errors upon import). I respect that.
This GH Issue has the answer. make sure that you adapt the ABSOLUTE caffe path to your particular installation:
echo <YOUR_CAFFE_ABSPATH>/distribute/lib > /etc/ld.so.conf.d/caffe.conf
ldconfig
And for the Python wrapper, the package also has to be added to PYTHONPATH. You can do this by extending said path, or by copying the package into an already existing path, in my case as follows:
cp -r <YOUR_CAFFE_ABSPATH>/distribute/python/caffe /usr/lib/python3/dist-packages
That's it! Now import caffe should work at any location.
Disclaimers:
I've tested it on a GPU-compatible Ubuntu18 Docker image (this one nvcr.io/nvidia/cuda:11.1-cudnn8-devel-ubuntu18.04) as root
I'm answering here because it is one of the top-ranked Google results for "install caffe for all users" and the GH issue isn't, so hopefully this helps someone!
I'd also be happy to hear from other solutions or remarks to make our Caffe life easier.
Cheers,
Andres

How to fix python: pip and django won't work (pkg.resource not found) on OS X with home dir on a different drive

I have an issue with my system: I have a small ssd, so I decided to move home to a different drive.
Everything works fine, but I cannot use neither pip, django nor any other python application, beside python itself, since I get an error all the time, saying
pkg_resources.DistributionNotFound: pip==1.5.6
From what I can see, it is loading the application in /usr/local/bin/pip, but then I get errors about the distribution not found.
The path that is continuously printing in the error is /System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/pkg_resources.py
I was searching online to figure out the problem, and I can't find a way to actually fix this, because none of the solutions found here and on other sites, works.
I think that it has something to do with my home directory saved in a different drive? Plus I am updating OS X since 10.6; which results in my python getting update every time and I have probably 4-5 different version of it.
Probably the paths are totally messed up; and I would like to know how to fix this (either nuking everything and re-installing python, pip and everything else, or just fixing the path).
I need to use Django and Pip, so would be great if you could give me some advice about what to look for and what to change. I do not have much experience with how python works on the OS that host it; I just make simple apps with it.
Ok, figured out:
1) moved anything in /opt/local to ~/local
2) did an edit in my profile (.bash_profile), removing any line that was adding PATH, like macports entry
3) Installed homebrew and then did a brew install python
4) once done, if I run Pip it works fine now.
No clue why; probably the install of python re-wrote the old PATH file and replaced it with a new one. Isee that the version that now I am running on Mavericks is 2.6.9.
Hope that this help someone else that may experience the same issue.

Installing Pygame - Registry wont show

I have a problem when trying to install Pygame. My Python is installed under Program Files in the C drive (C:\Program Files\Python). My registry wont show, and I have no idea what I shall do. Should it go under site-packages or what? Believe me, I've been searching around for ages in order to solve this. Please come with specific steps on what I shall do. Sorry, I'm new to this (as you can see). Correct me if I use registry wrong :)
First visit here.
Be sure that you have installed numpy properly and then check once more that you have downloaded the proper pygame binary for your specific OS (x32, x64).
If everything of the above fails, un-install python and reinstall it (again using the proper version).
I had some similar issues with PIL and after reinstalling python it fixed.
For picture issue: You can upload it to your dropbox or google drive and share here the link.
Edit: Be sure that python is in the environment variables path of windows
edit2: which version of python do you use. Python 2.x has some incoherences with python 3.x so check that too.

Categories