summaryrefslogtreecommitdiff
path: root/sci-libs/tensorflow/files/tensorflow-2.15.0-0013-build-use-non-hermetic-python.patch
blob: e36a3a0617bec7abc8b69650bdf3a16795aa2746 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
From 0b56f871d620371e1deb66822aa8fb6df68dc568 Mon Sep 17 00:00:00 2001
From: wangjiezhe <wangjiezhe@gmail.com>
Date: Fri, 22 Dec 2023 21:23:14 +0800
Subject: [PATCH 13/13] build: use non-hermetic python

---
 WORKSPACE                                     | 69 -------------------
 tensorflow/BUILD                              |  2 -
 tensorflow/compiler/mlir/glob_lit_test.bzl    |  1 -
 tensorflow/compiler/mlir/tfr/BUILD            |  2 -
 tensorflow/dtensor/python/tests/BUILD         |  1 -
 tensorflow/lite/python/BUILD                  |  1 -
 tensorflow/python/BUILD                       |  1 -
 tensorflow/python/autograph/converters/BUILD  | 11 ---
 tensorflow/python/autograph/core/BUILD        |  1 -
 tensorflow/python/autograph/pyct/BUILD        | 23 -------
 .../autograph/pyct/common_transformers/BUILD  |  2 -
 .../autograph/pyct/static_analysis/BUILD      |  6 --
 .../python/autograph/pyct/testing/BUILD       |  1 -
 tensorflow/python/client/BUILD                |  1 -
 tensorflow/python/compiler/tensorrt/BUILD     |  1 -
 .../experimental/kernel_tests/service/BUILD   |  1 -
 tensorflow/python/data/util/BUILD             |  2 -
 tensorflow/python/debug/lib/BUILD             |  1 -
 tensorflow/python/distribute/BUILD            |  5 --
 .../python/distribute/experimental/rpc/BUILD  |  1 -
 .../python/distribute/failure_handling/BUILD  |  2 -
 tensorflow/python/eager/BUILD                 |  2 -
 tensorflow/python/estimator/BUILD             |  4 +-
 tensorflow/python/framework/BUILD             |  7 --
 tensorflow/python/keras/BUILD                 |  1 -
 tensorflow/python/keras/engine/BUILD          |  1 -
 tensorflow/python/keras/saving/BUILD          |  1 -
 tensorflow/python/ops/BUILD                   |  2 -
 tensorflow/python/profiler/BUILD              |  1 -
 .../python/profiler/integration_test/BUILD    |  1 -
 tensorflow/python/summary/BUILD               |  1 -
 tensorflow/python/trackable/BUILD             |  1 -
 tensorflow/python/types/BUILD                 |  2 -
 tensorflow/python/util/BUILD                  |  3 -
 tensorflow/tools/docs/BUILD                   |  3 -
 third_party/xla/xla/glob_lit_test.bzl         |  5 --
 third_party/xla/xla/mlir_hlo/tests/BUILD      |  1 -
 37 files changed, 2 insertions(+), 169 deletions(-)

diff --git a/WORKSPACE b/WORKSPACE
index c10a2c4a482..3626ae4e805 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -11,75 +11,6 @@ http_archive(
     ],
 )
 
-# We must initialize hermetic python first.
-load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
-
-http_archive(
-    name = "bazel_skylib",
-    sha256 = "74d544d96f4a5bb630d465ca8bbcfe231e3594e5aae57e1edbf17a6eb3ca2506",
-    urls = [
-        "https://storage.googleapis.com/mirror.tensorflow.org/github.com/bazelbuild/bazel-skylib/releases/download/1.3.0/bazel-skylib-1.3.0.tar.gz",
-        "https://github.com/bazelbuild/bazel-skylib/releases/download/1.3.0/bazel-skylib-1.3.0.tar.gz",
-    ],
-)
-
-http_archive(
-    name = "rules_python",
-    sha256 = "9d04041ac92a0985e344235f5d946f71ac543f1b1565f2cdbc9a2aaee8adf55b",
-    strip_prefix = "rules_python-0.26.0",
-    url = "https://github.com/bazelbuild/rules_python/releases/download/0.26.0/rules_python-0.26.0.tar.gz",
-)
-
-load("@rules_python//python:repositories.bzl", "py_repositories")
-
-py_repositories()
-
-load("@rules_python//python:repositories.bzl", "python_register_toolchains")
-load(
-    "//tensorflow/tools/toolchains/python:python_repo.bzl",
-    "python_repository",
-)
-
-python_repository(name = "python_version_repo")
-
-load("@python_version_repo//:py_version.bzl", "HERMETIC_PYTHON_VERSION")
-
-python_register_toolchains(
-    name = "python",
-    ignore_root_user_error = True,
-    python_version = HERMETIC_PYTHON_VERSION,
-)
-
-load("@python//:defs.bzl", "interpreter")
-load("@rules_python//python:pip.bzl", "package_annotation", "pip_parse")
-
-NUMPY_ANNOTATIONS = {
-    "numpy": package_annotation(
-        additive_build_content = """\
-filegroup(
-    name = "includes",
-    srcs = glob(["site-packages/numpy/core/include/**/*.h"]),
-)
-cc_library(
-    name = "numpy_headers",
-    hdrs = [":includes"],
-    strip_include_prefix="site-packages/numpy/core/include/",
-)
-""",
-    ),
-}
-
-pip_parse(
-    name = "pypi",
-    annotations = NUMPY_ANNOTATIONS,
-    python_interpreter_target = interpreter,
-    requirements = "//:requirements_lock_" + HERMETIC_PYTHON_VERSION.replace(".", "_") + ".txt",
-)
-
-load("@pypi//:requirements.bzl", "install_deps")
-
-install_deps()
-
 # Initialize the TensorFlow repository and all dependencies.
 #
 # The cascade of load() statements and tf_workspace?() calls works around the
diff --git a/tensorflow/BUILD b/tensorflow/BUILD
index ffbe65fdc61..cd9d61797e8 100644
--- a/tensorflow/BUILD
+++ b/tensorflow/BUILD
@@ -1712,8 +1712,6 @@ py_library(
         "//tensorflow/lite/python:lite",
         "//tensorflow/lite/python/authoring",
         "//tensorflow/python:no_contrib",
-        "@pypi_keras//:pkg",
-        "@pypi_tensorboard//:pkg",
     ],
 )
 # copybara:comment_end
diff --git a/tensorflow/compiler/mlir/glob_lit_test.bzl b/tensorflow/compiler/mlir/glob_lit_test.bzl
index e689b4c0b31..f65c86b727b 100644
--- a/tensorflow/compiler/mlir/glob_lit_test.bzl
+++ b/tensorflow/compiler/mlir/glob_lit_test.bzl
@@ -58,7 +58,6 @@ def _run_lit_test(name, data, size, tags, driver, features, exec_properties):
             "@llvm-project//llvm:count",
             "@llvm-project//llvm:not",
         ],
-        deps = ["@pypi_lit//:pkg"],
         size = size,
         main = "lit.py",
         exec_properties = exec_properties,
diff --git a/tensorflow/compiler/mlir/tfr/BUILD b/tensorflow/compiler/mlir/tfr/BUILD
index f8dfcd1c0a6..9f13d2eb068 100644
--- a/tensorflow/compiler/mlir/tfr/BUILD
+++ b/tensorflow/compiler/mlir/tfr/BUILD
@@ -387,7 +387,6 @@ py_strict_library(
         "//tensorflow/python/framework:op_def_registry",
         "//tensorflow/python/platform:tf_logging",
         "//tensorflow/python/util:tf_inspect",
-        "@pypi_gast//:pkg",
     ],
 )
 
@@ -421,7 +420,6 @@ py_strict_library(
         "//tensorflow/python/autograph/pyct:transpiler",
         "//tensorflow/python/framework:op_def_registry",
         "//tensorflow/python/util:tf_inspect",
-        "@pypi_gast//:pkg",
     ],
 )
 
diff --git a/tensorflow/dtensor/python/tests/BUILD b/tensorflow/dtensor/python/tests/BUILD
index 498642cb5ff..e4482821869 100644
--- a/tensorflow/dtensor/python/tests/BUILD
+++ b/tensorflow/dtensor/python/tests/BUILD
@@ -326,7 +326,6 @@ pytype_strict_library(
         ":test_util",
         "//tensorflow/python/platform:client_testlib",
         "@absl_py//absl/flags",
-        "@pypi_portpicker//:pkg",
     ],
 )
 
diff --git a/tensorflow/lite/python/BUILD b/tensorflow/lite/python/BUILD
index 3ac3bb20eba..c37bbc385f1 100644
--- a/tensorflow/lite/python/BUILD
+++ b/tensorflow/lite/python/BUILD
@@ -310,7 +310,6 @@ py_strict_test(
         "//tensorflow/python/trackable:autotrackable",
         "//third_party/py/numpy",
         "@absl_py//absl/testing:parameterized",
-        "@pypi_jax//:pkg",
     ],
 )
 
diff --git a/tensorflow/python/BUILD b/tensorflow/python/BUILD
index 9810f8acd2e..056534591a3 100644
--- a/tensorflow/python/BUILD
+++ b/tensorflow/python/BUILD
@@ -589,7 +589,6 @@ py_strict_library(
     deps = [
         ":keras_lib",
         "//third_party/py/numpy",
-        "@pypi_scipy//:pkg",
         "@six_archive//:six",
     ],
 )
diff --git a/tensorflow/python/autograph/converters/BUILD b/tensorflow/python/autograph/converters/BUILD
index 5624f7611f3..11bc2cd9deb 100644
--- a/tensorflow/python/autograph/converters/BUILD
+++ b/tensorflow/python/autograph/converters/BUILD
@@ -13,7 +13,6 @@ py_strict_library(
         "//tensorflow/python/autograph/core:converter",
         "//tensorflow/python/autograph/lang:directives",
         "//tensorflow/python/autograph/pyct:templates",
-        "@pypi_gast//:pkg",
     ],
 )
 
@@ -39,7 +38,6 @@ py_strict_library(
         "//tensorflow/python/autograph/core:converter",
         "//tensorflow/python/autograph/pyct:parser",
         "//tensorflow/python/autograph/pyct:templates",
-        "@pypi_gast//:pkg",
     ],
 )
 
@@ -65,7 +63,6 @@ py_strict_library(
         "//tensorflow/python/autograph/core:converter",
         "//tensorflow/python/autograph/pyct:parser",
         "//tensorflow/python/autograph/pyct:templates",
-        "@pypi_gast//:pkg",
     ],
 )
 
@@ -80,7 +77,6 @@ py_strict_library(
         "//tensorflow/python/autograph/pyct:qual_names",
         "//tensorflow/python/autograph/pyct:templates",
         "//tensorflow/python/autograph/utils:ag_logging",
-        "@pypi_gast//:pkg",
     ],
 )
 
@@ -93,7 +89,6 @@ py_strict_library(
         "//tensorflow/python/autograph/lang:directives",
         "//tensorflow/python/autograph/pyct:anno",
         "//tensorflow/python/util:tf_inspect",
-        "@pypi_gast//:pkg",
     ],
 )
 
@@ -105,7 +100,6 @@ py_strict_library(
         "//tensorflow/python/autograph/core:converter",
         "//tensorflow/python/autograph/pyct:anno",
         "//tensorflow/python/autograph/pyct:templates",
-        "@pypi_gast//:pkg",
     ],
 )
 
@@ -127,7 +121,6 @@ py_strict_library(
         "//tensorflow/python/autograph/pyct/static_analysis:liveness",
         "//tensorflow/python/autograph/pyct/static_analysis:reaching_definitions",
         "//tensorflow/python/autograph/pyct/static_analysis:reaching_fndefs",
-        "@pypi_gast//:pkg",
     ],
 )
 
@@ -143,7 +136,6 @@ py_strict_library(
         "//tensorflow/python/autograph/pyct:templates",
         "//tensorflow/python/autograph/pyct/static_analysis:activity",
         "//tensorflow/python/autograph/pyct/static_analysis:annos",
-        "@pypi_gast//:pkg",
     ],
 )
 
@@ -160,7 +152,6 @@ py_strict_library(
         "//tensorflow/python/autograph/pyct:templates",
         "//tensorflow/python/autograph/pyct/static_analysis:activity",
         "//tensorflow/python/autograph/pyct/static_analysis:annos",
-        "@pypi_gast//:pkg",
     ],
 )
 
@@ -176,7 +167,6 @@ py_strict_library(
         "//tensorflow/python/autograph/pyct:templates",
         "//tensorflow/python/autograph/pyct/static_analysis:activity",
         "//tensorflow/python/autograph/pyct/static_analysis:annos",
-        "@pypi_gast//:pkg",
     ],
 )
 
@@ -187,7 +177,6 @@ py_strict_library(
     deps = [
         "//tensorflow/python/autograph/core:converter",
         "//tensorflow/python/autograph/pyct:templates",
-        "@pypi_gast//:pkg",
     ],
 )
 
diff --git a/tensorflow/python/autograph/core/BUILD b/tensorflow/python/autograph/core/BUILD
index 46983ab39f0..3ccdc20293c 100644
--- a/tensorflow/python/autograph/core/BUILD
+++ b/tensorflow/python/autograph/core/BUILD
@@ -37,7 +37,6 @@ py_strict_library(
     visibility = ["//tensorflow:__subpackages__"],
     deps = [
         "//tensorflow/python/autograph/pyct:errors",
-        "@pypi_gast//:pkg",
     ],
 )
 
diff --git a/tensorflow/python/autograph/pyct/BUILD b/tensorflow/python/autograph/pyct/BUILD
index 949d841e00c..31d4b026460 100644
--- a/tensorflow/python/autograph/pyct/BUILD
+++ b/tensorflow/python/autograph/pyct/BUILD
@@ -14,7 +14,6 @@ py_strict_library(
         ":ast_util",
         ":parser",
         ":qual_names",
-        "@pypi_gast//:pkg",
     ],
 )
 
@@ -32,7 +31,6 @@ py_strict_library(
         ":templates",
         ":transformer",
         "//tensorflow/python/autograph/utils:ag_logging",
-        "@pypi_gast//:pkg",
     ],
 )
 
@@ -44,7 +42,6 @@ py_strict_library(
         ":anno",
         ":parser",
         ":qual_names",
-        "@pypi_gast//:pkg",
     ],
 )
 
@@ -62,7 +59,6 @@ py_strict_library(
     name = "gast_util",
     srcs = ["gast_util.py"],
     visibility = ["//visibility:public"],
-    deps = ["@pypi_gast//:pkg"],
 )
 
 py_strict_library(
@@ -79,8 +75,6 @@ py_strict_library(
         ":errors",
         ":inspect_utils",
         "//tensorflow/python/util:tf_inspect",
-        "@pypi_astunparse//:pkg",
-        "@pypi_gast//:pkg",
     ],
 )
 
@@ -108,7 +102,6 @@ py_strict_library(
         ":parser",
         ":pretty_printer",
         "//tensorflow/python/util:tf_inspect",
-        "@pypi_gast//:pkg",
     ],
 )
 
@@ -116,7 +109,6 @@ py_strict_library(
     name = "anno",
     srcs = ["anno.py"],
     visibility = ["//visibility:public"],
-    deps = ["@pypi_gast//:pkg"],
 )
 
 py_strict_library(
@@ -134,7 +126,6 @@ py_strict_library(
         ":parser",
         ":pretty_printer",
         ":templates",
-        "@pypi_gast//:pkg",
     ],
 )
 
@@ -145,7 +136,6 @@ py_strict_library(
     deps = [
         ":anno",
         ":parser",
-        "@pypi_gast//:pkg",
     ],
 )
 
@@ -155,8 +145,6 @@ py_strict_library(
     visibility = ["//visibility:public"],
     deps = [
         ":anno",
-        "@pypi_astunparse//:pkg",
-        "@pypi_gast//:pkg",
     ],
 )
 
@@ -180,10 +168,6 @@ py_strict_library(
     name = "pretty_printer",
     srcs = ["pretty_printer.py"],
     visibility = ["//visibility:public"],
-    deps = [
-        "@pypi_gast//:pkg",
-        "@pypi_termcolor//:pkg",
-    ],
 )
 
 py_strict_test(
@@ -210,7 +194,6 @@ py_strict_test(
         ":pretty_printer",
         ":qual_names",
         "//tensorflow/python/platform:client_testlib",
-        "@pypi_gast//:pkg",
     ],
 )
 
@@ -234,7 +217,6 @@ py_strict_test(
         ":cfg",
         ":parser",
         "//tensorflow/python/platform:client_testlib",
-        "@pypi_gast//:pkg",
     ],
 )
 
@@ -250,7 +232,6 @@ py_strict_test(
         ":pretty_printer",
         "//tensorflow/python/platform:client_testlib",
         "//tensorflow/python/util:tf_inspect",
-        "@pypi_gast//:pkg",
     ],
 )
 
@@ -325,7 +306,6 @@ py_strict_test(
         ":parser",
         ":pretty_printer",
         "//tensorflow/python/platform:client_testlib",
-        "@pypi_gast//:pkg",
     ],
 )
 
@@ -365,7 +345,6 @@ py_strict_test(
         ":templates",
         "//tensorflow/python/platform:client_testlib",
         "@absl_py//absl/testing:parameterized",
-        "@pypi_gast//:pkg",
     ],
 )
 
@@ -380,7 +359,6 @@ py_strict_test(
         ":parser",
         ":transformer",
         "//tensorflow/python/platform:client_testlib",
-        "@pypi_gast//:pkg",
     ],
 )
 
@@ -393,6 +371,5 @@ py_strict_test(
         ":transformer",
         ":transpiler",
         "//tensorflow/python/platform:client_testlib",
-        "@pypi_gast//:pkg",
     ],
 )
diff --git a/tensorflow/python/autograph/pyct/common_transformers/BUILD b/tensorflow/python/autograph/pyct/common_transformers/BUILD
index 2be00498cf7..b9da2f210c9 100644
--- a/tensorflow/python/autograph/pyct/common_transformers/BUILD
+++ b/tensorflow/python/autograph/pyct/common_transformers/BUILD
@@ -16,7 +16,6 @@ py_strict_library(
         "//tensorflow/python/autograph/pyct:gast_util",
         "//tensorflow/python/autograph/pyct:templates",
         "//tensorflow/python/autograph/pyct:transformer",
-        "@pypi_gast//:pkg",
     ],
 )
 
@@ -32,6 +31,5 @@ py_strict_test(
         "//tensorflow/python/autograph/pyct:parser",
         "//tensorflow/python/autograph/pyct:transformer",
         "//tensorflow/python/platform:client_testlib",
-        "@pypi_gast//:pkg",
     ],
 )
diff --git a/tensorflow/python/autograph/pyct/static_analysis/BUILD b/tensorflow/python/autograph/pyct/static_analysis/BUILD
index 4329523b056..9c643ccd63c 100644
--- a/tensorflow/python/autograph/pyct/static_analysis/BUILD
+++ b/tensorflow/python/autograph/pyct/static_analysis/BUILD
@@ -14,7 +14,6 @@ py_strict_library(
         "//tensorflow/python/autograph/pyct:anno",
         "//tensorflow/python/autograph/pyct:cfg",
         "//tensorflow/python/autograph/pyct:transformer",
-        "@pypi_gast//:pkg",
     ],
 )
 
@@ -26,7 +25,6 @@ py_strict_library(
         "//tensorflow/python/autograph/pyct:anno",
         "//tensorflow/python/autograph/pyct:cfg",
         "//tensorflow/python/autograph/pyct:transformer",
-        "@pypi_gast//:pkg",
     ],
 )
 
@@ -56,7 +54,6 @@ py_strict_library(
         "//tensorflow/python/autograph/pyct:anno",
         "//tensorflow/python/autograph/pyct:qual_names",
         "//tensorflow/python/autograph/pyct:transformer",
-        "@pypi_gast//:pkg",
     ],
 )
 
@@ -71,7 +68,6 @@ py_strict_library(
         "//tensorflow/python/autograph/pyct:cfg",
         "//tensorflow/python/autograph/pyct:qual_names",
         "//tensorflow/python/autograph/pyct:transformer",
-        "@pypi_gast//:pkg",
     ],
 )
 
@@ -83,7 +79,6 @@ py_strict_library(
         "//tensorflow/python/autograph/pyct:anno",
         "//tensorflow/python/autograph/pyct:cfg",
         "//tensorflow/python/autograph/pyct:transformer",
-        "@pypi_gast//:pkg",
     ],
 )
 
@@ -107,7 +102,6 @@ py_strict_test(
         "//tensorflow/python/autograph/pyct:qual_names",
         "//tensorflow/python/autograph/pyct:transformer",
         "//tensorflow/python/platform:client_testlib",
-        "@pypi_gast//:pkg",
     ],
 )
 
diff --git a/tensorflow/python/autograph/pyct/testing/BUILD b/tensorflow/python/autograph/pyct/testing/BUILD
index 21a6775b0fb..fcac2065ca0 100644
--- a/tensorflow/python/autograph/pyct/testing/BUILD
+++ b/tensorflow/python/autograph/pyct/testing/BUILD
@@ -15,7 +15,6 @@ py_strict_library(
     deps = [
         "//tensorflow/python/autograph/pyct:templates",
         "//third_party/py/numpy",
-        "@pypi_gast//:pkg",
     ],
 )
 
diff --git a/tensorflow/python/client/BUILD b/tensorflow/python/client/BUILD
index c13a6122f41..77bc522a758 100644
--- a/tensorflow/python/client/BUILD
+++ b/tensorflow/python/client/BUILD
@@ -294,7 +294,6 @@ py_strict_library(
         "//tensorflow/python/util:nest",
         "//tensorflow/python/util:tf_export",
         "//third_party/py/numpy",
-        "@pypi_wrapt//:pkg",
     ],
 )
 
diff --git a/tensorflow/python/compiler/tensorrt/BUILD b/tensorflow/python/compiler/tensorrt/BUILD
index f3ca24c9a4b..ee086bdaed2 100644
--- a/tensorflow/python/compiler/tensorrt/BUILD
+++ b/tensorflow/python/compiler/tensorrt/BUILD
@@ -69,7 +69,6 @@ py_strict_library(
         "//tensorflow/python/util:nest",
         "//tensorflow/python/util:tf_export",
         "//third_party/py/numpy",
-        "@pypi_packaging//:pkg",
         "@six_archive//:six",
     ],
 )
diff --git a/tensorflow/python/data/experimental/kernel_tests/service/BUILD b/tensorflow/python/data/experimental/kernel_tests/service/BUILD
index cfac30fe0db..355a558bc93 100644
--- a/tensorflow/python/data/experimental/kernel_tests/service/BUILD
+++ b/tensorflow/python/data/experimental/kernel_tests/service/BUILD
@@ -143,7 +143,6 @@ tf_py_strict_test(
         "//tensorflow/python/ops:array_ops",
         "//tensorflow/python/platform:client_testlib",
         "@absl_py//absl/testing:parameterized",
-        "@pypi_portpicker//:pkg",
     ],
 )
 
diff --git a/tensorflow/python/data/util/BUILD b/tensorflow/python/data/util/BUILD
index f7298a6f66b..cef29c3d992 100644
--- a/tensorflow/python/data/util/BUILD
+++ b/tensorflow/python/data/util/BUILD
@@ -94,7 +94,6 @@ py_strict_library(
         "//tensorflow/python/util:deprecation",
         "//tensorflow/python/util:nest_util",
         "//tensorflow/python/util:tf_export",
-        "@pypi_wrapt//:pkg",
     ],
 )
 
@@ -125,7 +124,6 @@ py_strict_test(
         "//tensorflow/python/util:compat",
         "//third_party/py/numpy",
         "@absl_py//absl/testing:parameterized",
-        "@pypi_wrapt//:pkg",
     ],
 )
 
diff --git a/tensorflow/python/debug/lib/BUILD b/tensorflow/python/debug/lib/BUILD
index 37c99b30dd2..012e349dffc 100644
--- a/tensorflow/python/debug/lib/BUILD
+++ b/tensorflow/python/debug/lib/BUILD
@@ -596,7 +596,6 @@ py_strict_library(
         "//tensorflow/python/lib/io:lib",
         "//tensorflow/python/ops:variables",
         "//tensorflow/python/util:compat",
-        "@pypi_portpicker//:pkg",
     ],
 )
 
diff --git a/tensorflow/python/distribute/BUILD b/tensorflow/python/distribute/BUILD
index 0c233b2b4a4..19b496f427a 100644
--- a/tensorflow/python/distribute/BUILD
+++ b/tensorflow/python/distribute/BUILD
@@ -523,7 +523,6 @@ cuda_py_strict_test(
         "//tensorflow/python/ops:variable_scope",
         "//third_party/py/numpy",
         "@absl_py//absl/testing:parameterized",
-        "@pypi_dill//:pkg",  # build_cleaner: keep
     ],
 )
 
@@ -1440,7 +1439,6 @@ cuda_py_strict_test(
         "//tensorflow/python/ops:math_ops",
         "//tensorflow/python/util:nest",
         "@absl_py//absl/testing:parameterized",
-        "@pypi_dill//:pkg",  # build_cleaner: keep
     ],
 )
 
@@ -1764,7 +1762,6 @@ distribute_py_strict_test(
         "//tensorflow/python/ops:variable_v1",
         "//tensorflow/python/saved_model/model_utils:mode_keys",
         "@absl_py//absl/testing:parameterized",
-        "@pypi_wrapt//:pkg",
     ],
 )
 
@@ -2295,8 +2292,6 @@ py_strict_library(
         "//tensorflow/python/framework:test_lib",
         "//tensorflow/python/util:tf_export",
         "@absl_py//absl/logging",
-        "@pypi_dill//:pkg",  # build_cleaner: keep
-        "@pypi_tblib//:pkg",  # build_cleaner: keep
         "@six_archive//:six",
     ],
 )
diff --git a/tensorflow/python/distribute/experimental/rpc/BUILD b/tensorflow/python/distribute/experimental/rpc/BUILD
index 3a3682cd6cf..8ed343db636 100644
--- a/tensorflow/python/distribute/experimental/rpc/BUILD
+++ b/tensorflow/python/distribute/experimental/rpc/BUILD
@@ -60,6 +60,5 @@ tf_py_strict_test(
         "//tensorflow/python/ops:variables",
         "//tensorflow/python/platform:client_testlib",
         "//tensorflow/python/util:nest",
-        "@pypi_portpicker//:pkg",
     ],
 )
diff --git a/tensorflow/python/distribute/failure_handling/BUILD b/tensorflow/python/distribute/failure_handling/BUILD
index c9af884fbb7..3aaad5eced1 100644
--- a/tensorflow/python/distribute/failure_handling/BUILD
+++ b/tensorflow/python/distribute/failure_handling/BUILD
@@ -47,7 +47,6 @@ py_strict_library(
     deps = [
         "//tensorflow/python/eager:context",
         "//tensorflow/python/platform:tf_logging",
-        "@pypi_requests//:pkg",
         "@six_archive//:six",
     ],
 )
@@ -134,7 +133,6 @@ tf_py_strict_test(
         "//tensorflow/python/platform:tf_logging",
         "//tensorflow/python/training:server_lib",
         "@absl_py//absl/testing:parameterized",
-        "@pypi_dill//:pkg",  # build_cleaner: keep
     ],
 )
 
diff --git a/tensorflow/python/eager/BUILD b/tensorflow/python/eager/BUILD
index e72f54c48fd..057bce876fd 100644
--- a/tensorflow/python/eager/BUILD
+++ b/tensorflow/python/eager/BUILD
@@ -1180,7 +1180,6 @@ cuda_py_strict_test(
         "//tensorflow/python/training:server_lib",
         "//tensorflow/python/util:compat",
         "@absl_py//absl/testing:parameterized",
-        "@pypi_portpicker//:pkg",
     ],
 )
 
@@ -1320,7 +1319,6 @@ py_strict_library(
         "//tensorflow/python/autograph/pyct/static_analysis:reaching_fndefs",
         "//tensorflow/python/framework:op_def_registry",
         "//tensorflow/python/framework:ops",
-        "@pypi_gast//:pkg",
     ],
 )
 
diff --git a/tensorflow/python/estimator/BUILD b/tensorflow/python/estimator/BUILD
index 73afdd8b239..7e58789cee5 100644
--- a/tensorflow/python/estimator/BUILD
+++ b/tensorflow/python/estimator/BUILD
@@ -382,7 +382,7 @@ py_library(
     ],
 )
 
-alias(
+py_library(
     name = "expect_tensorflow_estimator_installed",
-    actual = "@pypi_tensorflow_estimator//:pkg",
+    srcs_version = "PY3",
 )
diff --git a/tensorflow/python/framework/BUILD b/tensorflow/python/framework/BUILD
index 9bfb9d2d9dd..19b43eab9ac 100644
--- a/tensorflow/python/framework/BUILD
+++ b/tensorflow/python/framework/BUILD
@@ -279,7 +279,6 @@ py_strict_library(
         "//tensorflow/python/eager:execute",
         "//tensorflow/security/fuzzing/py:annotation_types",
         "//tensorflow/tools/docs:doc_controls",
-        "@pypi_typing_extensions//:pkg",
     ],
 )
 
@@ -365,7 +364,6 @@ py_strict_library(
         "//tensorflow/python/util:deprecation",
         "//tensorflow/python/util:tf_export",
         "//third_party/py/numpy",
-        "@pypi_packaging//:pkg",
     ] + if_xla_available([
         "//tensorflow/python:_pywrap_tfcompile",
     ]),
@@ -1760,7 +1758,6 @@ py_strict_library(
     deps = [
         ":composite_tensor",
         "//tensorflow/python/util:nest",
-        "@pypi_typing_extensions//:pkg",
     ],
 )
 
@@ -1788,7 +1785,6 @@ py_strict_library(
         "//tensorflow/python/util:nest",
         "//tensorflow/python/util:tf_decorator",
         "//tensorflow/python/util:tf_export",
-        "@pypi_typing_extensions//:pkg",
     ],
 )
 
@@ -1932,7 +1928,6 @@ pytype_strict_library(
         "//tensorflow/python/lib/io:lib",
         "//tensorflow/python/platform:tf_logging",
         "//tensorflow/python/util:compat",
-        "@pypi_packaging//:pkg",
     ],
 )
 
@@ -2185,7 +2180,6 @@ py_strict_library(
         "//tensorflow/python/util/protobuf",
         "//third_party/py/numpy",
         "@absl_py//absl/testing:parameterized",
-        "@pypi_portpicker//:pkg",
     ],
 )
 
@@ -2781,7 +2775,6 @@ tf_py_strict_test(
         "//tensorflow/python/util:nest",
         "//tensorflow/python/util:tf_decorator",
         "@absl_py//absl/testing:parameterized",
-        "@pypi_typing_extensions//:pkg",
     ],
 )
 
diff --git a/tensorflow/python/keras/BUILD b/tensorflow/python/keras/BUILD
index f9e31edae67..011cc3a73b8 100755
--- a/tensorflow/python/keras/BUILD
+++ b/tensorflow/python/keras/BUILD
@@ -44,7 +44,6 @@ py_library(
         "//tensorflow/python/saved_model",
         "//tensorflow/python/training",
         "//tensorflow/python/util:nest",
-        "@pypi_h5py//:pkg",
     ],
 )
 
diff --git a/tensorflow/python/keras/engine/BUILD b/tensorflow/python/keras/engine/BUILD
index a24dc27b25f..1b95ca18d06 100644
--- a/tensorflow/python/keras/engine/BUILD
+++ b/tensorflow/python/keras/engine/BUILD
@@ -95,7 +95,6 @@ py_library(
         "//tensorflow/python/util:tf_decorator",
         "//tensorflow/python/util:tf_export",
         "//tensorflow/tools/docs:doc_controls",
-        "@pypi_h5py//:pkg",
     ],
 )
 
diff --git a/tensorflow/python/keras/saving/BUILD b/tensorflow/python/keras/saving/BUILD
index db1d2d814ca..b37abc164b3 100644
--- a/tensorflow/python/keras/saving/BUILD
+++ b/tensorflow/python/keras/saving/BUILD
@@ -55,6 +55,5 @@ py_library(
         "//tensorflow/python/platform:tf_logging",
         "//tensorflow/python/saved_model",
         "//tensorflow/python/training:saver",
-        "@pypi_h5py//:pkg",
     ],
 )
diff --git a/tensorflow/python/ops/BUILD b/tensorflow/python/ops/BUILD
index b3a3d612a01..c242923f832 100644
--- a/tensorflow/python/ops/BUILD
+++ b/tensorflow/python/ops/BUILD
@@ -2780,7 +2780,6 @@ py_strict_library(
         "//tensorflow/python/util:dispatch",
         "//tensorflow/python/util:tf_export",
         "//third_party/py/numpy",
-        "@pypi_opt_einsum//:pkg",
     ],
 )
 
@@ -3872,7 +3871,6 @@ cuda_py_strict_test(
         "//tensorflow/python/platform:tf_logging",
         "//third_party/py/numpy",
         "@absl_py//absl/testing:parameterized",
-        "@pypi_opt_einsum//:pkg",
     ],
 )
 
diff --git a/tensorflow/python/profiler/BUILD b/tensorflow/python/profiler/BUILD
index b1cfd6ea10c..9413aeeab8b 100644
--- a/tensorflow/python/profiler/BUILD
+++ b/tensorflow/python/profiler/BUILD
@@ -43,7 +43,6 @@ cuda_py_strict_test(
         "//tensorflow/python/eager:test",
         "//tensorflow/python/framework:errors",
         "//tensorflow/python/framework:test_lib",
-        "@pypi_portpicker//:pkg",
     ],
 )
 
diff --git a/tensorflow/python/profiler/integration_test/BUILD b/tensorflow/python/profiler/integration_test/BUILD
index b20698ea6ea..e7060e5a315 100644
--- a/tensorflow/python/profiler/integration_test/BUILD
+++ b/tensorflow/python/profiler/integration_test/BUILD
@@ -35,6 +35,5 @@ cuda_py_strict_test(
         "//tensorflow/python/platform:tf_logging",
         "//tensorflow/python/profiler:profiler_client",
         "//tensorflow/python/profiler:profiler_v2",
-        "@pypi_portpicker//:pkg",
     ],
 )
diff --git a/tensorflow/python/summary/BUILD b/tensorflow/python/summary/BUILD
index 126fb6d31f7..b292e39356f 100644
--- a/tensorflow/python/summary/BUILD
+++ b/tensorflow/python/summary/BUILD
@@ -121,6 +121,5 @@ tf_py_strict_test(
         "//tensorflow/python/ops:summary_ops_v2",
         "//tensorflow/python/platform:client_testlib",
         "//tensorflow/python/training:training_util",
-        "@pypi_tensorboard//:pkg",
     ],
 )
diff --git a/tensorflow/python/trackable/BUILD b/tensorflow/python/trackable/BUILD
index 30efc64b5fd..2e2390a6643 100644
--- a/tensorflow/python/trackable/BUILD
+++ b/tensorflow/python/trackable/BUILD
@@ -225,7 +225,6 @@ py_strict_library(
         "//tensorflow/python/ops:variables",
         "//tensorflow/python/util:compat",
         "//tensorflow/python/util:tf_export",
-        "@pypi_wrapt//:pkg",
     ],
 )
 
diff --git a/tensorflow/python/types/BUILD b/tensorflow/python/types/BUILD
index c04dc039153..43a030a051e 100644
--- a/tensorflow/python/types/BUILD
+++ b/tensorflow/python/types/BUILD
@@ -24,7 +24,6 @@ pytype_strict_library(
         "//tensorflow/python/util:_pywrap_utils",
         "//tensorflow/python/util:tf_export",
         "//third_party/py/numpy",
-        "@pypi_typing_extensions//:pkg",
     ],
 )
 
@@ -71,7 +70,6 @@ pytype_strict_library(
         ":core",
         "//tensorflow/python/util:tf_export",
         "//tensorflow/tools/docs:doc_controls",
-        "@pypi_typing_extensions//:pkg",
     ],
 )
 
diff --git a/tensorflow/python/util/BUILD b/tensorflow/python/util/BUILD
index d1e7d626a1d..248eb23bcfe 100644
--- a/tensorflow/python/util/BUILD
+++ b/tensorflow/python/util/BUILD
@@ -732,7 +732,6 @@ py_strict_library(
         # py_test because not all tensorflow tests use tensorflow.bzl's py_test.
         "//tensorflow/python:global_test_configuration",
         "@six_archive//:six",
-        "@pypi_wrapt//:pkg",
         "//tensorflow/python:pywrap_tensorflow",
         ":_pywrap_utils",
     ],
@@ -893,7 +892,6 @@ py_strict_library(
         # py_test because not all tensorflow tests use tensorflow.bzl's py_test.
         "//tensorflow/python:global_test_configuration",
         "//third_party/py/numpy",
-        "@pypi_wrapt//:pkg",
     ],
 )
 
@@ -1029,7 +1027,6 @@ py_strict_library(
         # py_test because not all tensorflow tests use tensorflow.bzl's py_test.
         "//tensorflow/python:global_test_configuration",
         ":tf_export",
-        "@pypi_wrapt//:pkg",
         ":_pywrap_utils",
         ":_pywrap_nest",
     ],
diff --git a/tensorflow/tools/docs/BUILD b/tensorflow/tools/docs/BUILD
index aa9490cf911..48e45b23a2a 100644
--- a/tensorflow/tools/docs/BUILD
+++ b/tensorflow/tools/docs/BUILD
@@ -137,7 +137,6 @@ py_strict_library(
     srcs = ["fenced_doctest_lib.py"],
     deps = [
         ":tf_doctest_lib",
-        "@pypi_astor//:pkg",
     ],
 )
 
@@ -178,7 +177,6 @@ py_strict_test(
         # copybara:uncomment "//third_party/py/tensorflow:tensorflow_estimator",
         "//tensorflow:tensorflow_py",
         "//tensorflow/python/platform:test",
-        "@pypi_packaging//:pkg",
     ],
 )
 
@@ -214,7 +212,6 @@ py_strict_library(
         "//tensorflow/python/util:tf_inspect",
         "@absl_py//absl:app",
         "@absl_py//absl/flags",
-        "@pypi_packaging//:pkg",
     ],
 )
 
diff --git a/third_party/xla/xla/glob_lit_test.bzl b/third_party/xla/xla/glob_lit_test.bzl
index 79b4adc3edd..5893eba46c2 100644
--- a/third_party/xla/xla/glob_lit_test.bzl
+++ b/third_party/xla/xla/glob_lit_test.bzl
@@ -52,10 +52,6 @@ def _run_lit_test(name, data, size, tags, driver, features, exec_properties):
     # can remove this logic. This is necessary to have these tests run on builds
     # using Python 3.11, but also to not include `@pypi_lit` in standalone xla
     # builds where it won't be found.
-    deps = []
-    if xla_root_dir == "tensorflow/compiler/xla/":
-        deps.append("@pypi_lit//:pkg")
-
     native.py_test(
         name = name,
         srcs = ["@llvm-project//llvm:lit"],
@@ -69,7 +65,6 @@ def _run_lit_test(name, data, size, tags, driver, features, exec_properties):
             "@llvm-project//llvm:count",
             "@llvm-project//llvm:not",
         ],
-        deps = deps,
         size = size,
         main = "lit.py",
         exec_properties = exec_properties,
diff --git a/third_party/xla/xla/mlir_hlo/tests/BUILD b/third_party/xla/xla/mlir_hlo/tests/BUILD
index 89c6533956f..771d337be08 100644
--- a/third_party/xla/xla/mlir_hlo/tests/BUILD
+++ b/third_party/xla/xla/mlir_hlo/tests/BUILD
@@ -27,7 +27,6 @@ package(
         tags = [
             "nomsan",  # The execution engine doesn't work with msan, see b/248097619.
         ],
-        deps = ["@pypi_lit//:pkg"],
     )
     for src in glob(["**/*.mlir"])
 ]
-- 
2.41.0