How do you install bazel using bazelisk - python

Or better yet, how do you install bazel at all. I have been using cd to get into a folder on my desktop, then I used git clone https://github.com/bazelbuild/bazelisk and then? What am I supposed to do now, honestly I didn't find any real instruction for this, I have many folder in there now, am I supposed to run a special file like bazelisk.py now? Or like build it? Was I supposed to clone the github repository in a special location? As mentioned I just choose a folder on my desktop, but I added the path to my Path enviromental variable, I added C:\Users\user\Desktop\folder\bazel and C:\Users\user\Desktop\folder\bazel\bazelisk because I wasn't sure how far I should go. So if anybody could show me how to install bazel at all I would be thankful, I just need it for a python project, I am using python 3.6.2 and I am on windows 10. I don't know what to do now because the installation steps I've read only go as far as saying to git clone the repository, but when I enter cmd and type bazel or bazel help cmd can not find the command.

From Official Bazel Documentation
https://github.com/bazelbuild/bazelisk/blob/master/README.md ->
Bazelisk is a wrapper for Bazel written in Go. It automatically picks a good version of Bazel given your current working directory, downloads it from the official server (if required) and then transparently passes through all command-line arguments to the real Bazel binary. You can call it just like you would call Bazel.
Steps to Installing Bazelisk in Linux/Mac/Windows
Below steps show installation of bazelisk v1.8.1, but you can install any desired version from https://github.com/bazelbuild/bazelisk/releases using same steps
Steps for Bazelisk Linux Install
> wget https://github.com/bazelbuild/bazelisk/releases/download/v1.8.1/bazelisk-linux-amd64
> chmod +x bazelisk-linux-amd64
> sudo mv bazelisk-linux-amd64 /usr/local/bin/bazel
# make sure you get the binary available in $PATH
> which bazel
bazel is /usr/local/bin/bazel
Steps for Bazelisk Mac Install
wget https://github.com/bazelbuild/bazelisk/releases/download/v1.8.1/bazelisk-darwin-amd64
chmod +x bazelisk-darwin-amd64
sudo mv bazelisk-darwin-amd64 /usr/local/bin/bazel
Steps for Bazelisk Windows Install
Download and install Bazelisk windows binary from https://github.com/bazelbuild/bazelisk/releases
How to use Bazelisk and set desired Bazel version
If the environment variable USE_BAZEL_VERSION is set, it will use the
version specified in the value.
Otherwise, if a .bazeliskrc file exists in the workspace root and
contains the USE_BAZEL_VERSION variable, this version will be used.
Otherwise, if a .bazelversion file exists in the current directory or
recursively any parent directory, it will read the file and use the
version specified in it.
Otherwise it will use the official latest Bazel release.
Common issues you might face
When bazel version is updated in WORKSPACE file and if you are unable to see bazel version update after bazel version call
Then try removing old bazel binary /usr/local/bin/bazel and again do bazelisk installation mentioned above.

Since you are using Windows I will describe the Windows way of doing it (it is also similar on other platforms)
Download a prebuild version of bazelisk.exe. You can find prebuilt versions here. For instance, v1.7.4. Then rename bazelisk-windows-amd64.exe to bazelisk.exe and add it to your PATH environment variable. When you open now a PowerShell and type bazelisk info you should see some output.
bazelisk is only a wrapper around bazel which means you have still to setup everything to make Bazel working on your system. bazelisk just redirects all commands to Bazel. bazelisk just cares about which version of Bazel is used (e.g. you can define in a .bazelversion file wich version of Bazel should be used). I suggest you to follow the instructions listed here that describe what needs to be done to get Bazel working on Windows (for instance installing MSYS2 makes sense).

Related

I can not use bazel to build tensorflow because I installed bazel with bazelisk?

I installed a bazelisk exe file and included that file in my environmental Path variable. I can now run bazelisk commands but no bazel commands and I think I was told that that was normal. Is it? If it is, if I cd into my tensorflow folder and run python ./configure.py because I think that that is a step I need to do to build tensorflow from source I get the message Cannot find bazel. Please install bazel. What am I supposed to do? I am using python 3.6.2 and windows 10 and bazelisk is on v1.7.4
Try to rename bazelisk to bazel because it is just a wrapper for bazel

bazel build tensorflow/tools/graph_transforms:transform_graph ERROR

i have some problem when i want to transfer my model using bazel to convert it.
i try this cmd:
$ bazel build tensorflow/tools/graph_transforms:transform_graph
here are the error:
ERROR: Skipping 'tensorflow/tools/graph_transforms:transform_graph': no such package 'tensorflow/tools/graph_transforms': BUILD file not found on package path
can any body tell me how to use it?
thanks a lot
then i try this cmd:
$ bazel build tensorflow/tools/graph_transforms:vgg_16_10000.pb
i put have graph_transforms in tools directory and vgg_16_10000.pb in graph_transforms.
and i still get the same problem.
In order to run that first command (bazel build) you must have a BUILD file at the specified directory, which in this case is tensorflow/tools/graph_transforms. Based on only the info you've provided, chances are you haven't actually cloned or downloaded the Tensorflow repository. You cannot simply run that command if you only have installed Tensorflow using pip or conda install, since those do not include the source code.
That should be enough information for you to decide whether you actually want to build sources or use the python API, as shown here.
Navigate to the root of the tensorflow source directory run ./configure first:
$ ./configure
$ bazel build tensorflow/tools/graph_transforms:summarize_graph

Conda is corrupted after pip install conda

My conda is corrupted after I run command "pip install conda". Is there any way to recover it ? Thanks
Here's the error I see when running conda command
ERROR: The install method you used for conda--probably either `pip install conda`
or `easy_install conda`--is not compatible with using conda as an application.
If your intention is to install conda as a standalone application, currently
supported install methods include the Anaconda installer and the miniconda
installer. You can download the miniconda installer from
https://conda.io/miniconda.html.
Simply, follow the instructions given in the error:
Download miniconda, then run the script file by typing following command: bash <file_name.sh> e.g.
bash Miniconda3-latest-Linux-x86_64.sh.
Now reopen the terminal for the changes to take effect.
If conda is already installed on your system, you can reinstall it with the -f force option, for example,
bash Miniconda3-latest-Linux-x86_64.sh -f
To test your installation, enter the command conda --version. If installed correctly, you will see the version of conda installed.
miniconda: https://conda.io/en/latest/miniconda.html
conda troubleshooting: https://conda.io/docs/troubleshooting.html
If you are facing this problem in Virtual Machine (VM) then you have to activate the main environment by running below line of code:
source /anaconda_installation_folder_path/bin/activate
Once you are in your main environment you can work with conda.
TL;DR: nothing is corrupted, the message you're seeing is a hardcoded stub and could be fixed.
conda package manager actually can be used with regular python installation.
Update: I've been tinkering with the described method and found that you should use conda install --dry-run ... to see changes that are going to happen. Some conda packages depend on other python version, which would overwrite the installed one. There's might be a solution for this with changing conda channels or using virtualenv. I also found that --dry-run doesn't work when using local package archives.
I'll show you how to run cudatoolkit 9.1 without any Anaconda and python-3.6-amd64. I'm using cuda 9.1 from here.
Since conda is artificially tethered with Anaconda, you have to untie them.
I recommend you to backup up python installation directory you'll be working with (or use virtualenv).
Install menuinst dependency.
At the moment, it's broken from PyPi, so get if from
github. Build it and install python setup.py install
This package is problematic also in Anaconda distribution. It triggers series of requests for admin rights every time, which should be suppressed with conda ... --no-shortcuts option.
pip install pypiwin32, dependency of (1)
pip install conda, requires (1)
Move to python installation directory. ./Scripts/conda.exe should exist.
Move to ./Lib/site-packages/conda
Search directory recursively for pip_warning substring in following TEXT file types: .py, .json, .txt
Replace matching substrings pip_warning with main
Don't forget to abide the syntax of file types you'd be editing.
Now open the ./Scripts/conda.exe executable in any hex-editor and
find pip_warning, carefully overwrite it with main and wipe the
rest with spaces until bytes import main
Check for file size not have changed.
Remove any __pycache__ dirs if found in ./Lib/site-packages/conda
If you only need working conda without cuda, you're done here.
Run conda install mkl, pip install llvmlite numpy
Download packages cudatoolkit-9.1-0.tar.bz2
and numba-0.36.2.tar.bz2
and run
conda install cudatoolkit-9.1-0.tar.bz2
conda install numba-0.36.2-***.tar.bz2
Wait a little while unpacking finished.
Now try these examples, they should work and your gpu monitor show some activity. conda ... commands also do work.
With Linux, I guess instructions are the same, just would be .sh or ELF in place of .exe.
In my case, what worked was:
pip uninstall conda
and then installing miniconda
Download miniconda, then run the script file by typing following command: bash <file_name.sh> e.g. bash Miniconda3-latest-Linux-x86_64.sh -u
'-u' : update tag, used if the original conda bash paths get lost due to certain modifications in the .bashrc file

Emacs elpy Flymake can't find pyflakes even though pyflake has been installed by pip

After using macports pip-2.7 to install pyflakes, I can run it manually from the pip installation directory using the command line like:
python /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pyflakes myfile.py
However, I'm trying to get my mac emacs environment setup with elpy, and flymake seems to not be able to find pyflakes, giving me a dialog when I open up a python file in elpy mode saying:
Flymake: Failed to launch syntax check process 'pyflakes' (with args myfile.py): Searching for program: no such file or directory, pyflakes. Flymake will be switched off.
I could go into /opt/local/bin and try to write my own executable file that runs the above python command. But that seems hacky and there must be a proper way to install/setup pyflakes such that flymake can find the command without manually creating wrapper scripts, isn't there?
I can run it manually from the pip installation directory using the command line like:
python /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pyflakes myfile.py
Unless this directory is in your $PATH, Emacs has no way to know where to find pyflakes.
One option would be to create a symbolic link, e.g.
ln -s /opt/local/.../python2.7/site-packages/pyflakes /opt/local/bin/pyflakes
Of course, you will have to use the full path. I shortened it for readability. This is relatively common on Linux machines, though I don't know how broadly it is used on OSX.
Another option, one which I prefer, would be to reinstall pyflakes using pip install's --user option:
--user
Install to the Python user install directory for your platform. Typically ~/.local/, or %APPDATA%Python on Windows. (See the Python documentation for site.USER_BASE for full details.)
--user is great for installing things that you might want to run independently of any particular project, like pyflakes. It installs things to your home directory instead of to a system directory, so you don't need any elevated privileges to use it.
You may have to add the user location to your $PATH variable, but you'll only have to do this once. Any future tools installed using pip install --user will become available immediately.
On my Linux machine, the directory that I had to add to my $PATH is ~/.local/bin/.

pip install custom include path

On an ubuntu system on which I don't have sudo previleges, I wish to install a package via pip (matplotlib to be precise), but some source packages are not installed on the system (however the binaries are installed).
I have created a virtual environment in which to install, and have downloaded the required source code, but I can't place them in the default /usr/include/ etc.. When pip runs matplotlib's setup.py script, the source files are reported as missing.
Is there a way to instruct pip or setup.py where to look for the source?
ps: setting CFLAGS or CPPFLAGS adds the locations of the downloaded source to compile instructions, but setup.py didn't find the source, so didn't attempt to compile some components (graphic backends).
pps: this is similar to, but more specific than this question
I would suggest doing:
Rebuild whatever binaries you need in your own home directory (this also avoids an issue if the apps get upgraded on the system or are otherwise different versions from your source). Assuming the programs use the standard configure scripts, you can do
mkdir ~/dev
cd app_src
./configure --prefix=~/dev
make; make install
Then when you want to do your pip install, do
export PATH=~/dev/bin:$PATH
export LD_LIBRARY_PATh=~/dev/lib
(Note, what I should be suggesting is pointing it to your virtualenv but I haven't had the issue you're having)
Do the pip install; if memory serves, pkg-config should pick up the info you want (this assumes matplotlib uses pkg-config to figure out where packages are stored)

Categories

Resources